@uoyo/mvtt 2.0.0-beta.0 → 2.0.0-beta.2

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 (151) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +194 -209
  3. package/dist/build/assembler.d.ts.map +1 -1
  4. package/dist/build/assembler.js +2 -0
  5. package/dist/build/assembler.js.map +1 -1
  6. package/dist/build/plan-validator.d.ts +26 -0
  7. package/dist/build/plan-validator.d.ts.map +1 -0
  8. package/dist/build/plan-validator.js +225 -0
  9. package/dist/build/plan-validator.js.map +1 -0
  10. package/dist/build/section-loader.d.ts.map +1 -1
  11. package/dist/build/section-loader.js +45 -9
  12. package/dist/build/section-loader.js.map +1 -1
  13. package/dist/cli.d.ts.map +1 -1
  14. package/dist/cli.js +2 -11
  15. package/dist/cli.js.map +1 -1
  16. package/dist/commands/doctor.d.ts.map +1 -1
  17. package/dist/commands/doctor.js +0 -1
  18. package/dist/commands/doctor.js.map +1 -1
  19. package/dist/commands/install.d.ts +1 -4
  20. package/dist/commands/install.d.ts.map +1 -1
  21. package/dist/commands/install.js +18 -14
  22. package/dist/commands/install.js.map +1 -1
  23. package/dist/commands/migrate.d.ts +16 -0
  24. package/dist/commands/migrate.d.ts.map +1 -0
  25. package/dist/commands/migrate.js +118 -0
  26. package/dist/commands/migrate.js.map +1 -0
  27. package/dist/commands/update.d.ts.map +1 -1
  28. package/dist/commands/update.js +35 -2
  29. package/dist/commands/update.js.map +1 -1
  30. package/dist/fs/core-manifest.d.ts +17 -0
  31. package/dist/fs/core-manifest.d.ts.map +1 -0
  32. package/dist/fs/core-manifest.js +76 -0
  33. package/dist/fs/core-manifest.js.map +1 -0
  34. package/dist/fs/install-manifest.d.ts +1 -2
  35. package/dist/fs/install-manifest.d.ts.map +1 -1
  36. package/dist/fs/install-manifest.js +1 -2
  37. package/dist/fs/install-manifest.js.map +1 -1
  38. package/dist/fs/materialize.d.ts.map +1 -1
  39. package/dist/fs/materialize.js +23 -3
  40. package/dist/fs/materialize.js.map +1 -1
  41. package/dist/types/core-manifest.d.ts +12 -0
  42. package/dist/types/core-manifest.d.ts.map +1 -0
  43. package/dist/types/core-manifest.js +2 -0
  44. package/dist/types/core-manifest.js.map +1 -0
  45. package/dist/types/registry.d.ts +13 -5
  46. package/dist/types/registry.d.ts.map +1 -1
  47. package/install-manifest.yaml +31 -27
  48. package/package.json +57 -57
  49. package/registry.yaml +198 -209
  50. package/sources/defaults/config.yaml +27 -30
  51. package/sources/defaults/project-context.yaml +15 -26
  52. package/sources/defaults/session.yaml +31 -23
  53. package/sources/knowledge/core/manifest.yaml +4 -45
  54. package/sources/sections/activation-load-config.md +11 -5
  55. package/sources/sections/activation-load-context.md +26 -11
  56. package/sources/sections/activation-preflight.md +14 -4
  57. package/sources/sections/footer-next-steps.md +35 -9
  58. package/sources/sections/output-language-constraint.md +11 -0
  59. package/sources/sections/role-header.md +13 -13
  60. package/sources/sections/session-update.md +47 -0
  61. package/sources/skills/mvt-analyze/business.md +69 -33
  62. package/sources/skills/mvt-analyze/manifest.yaml +90 -89
  63. package/sources/skills/mvt-analyze-code/business.md +82 -35
  64. package/sources/skills/mvt-analyze-code/manifest.yaml +96 -88
  65. package/sources/skills/mvt-bug-detect/business.md +101 -0
  66. package/sources/skills/mvt-bug-detect/manifest.yaml +84 -0
  67. package/sources/skills/mvt-check-context/business.md +89 -42
  68. package/sources/skills/mvt-check-context/manifest.yaml +63 -74
  69. package/sources/skills/mvt-cleanup/business.md +80 -31
  70. package/sources/skills/mvt-cleanup/manifest.yaml +85 -93
  71. package/sources/skills/mvt-config/business.md +94 -26
  72. package/sources/skills/mvt-config/manifest.yaml +96 -108
  73. package/sources/skills/mvt-create-skill/business.md +231 -111
  74. package/sources/skills/mvt-create-skill/manifest.yaml +91 -79
  75. package/sources/skills/mvt-design/business.md +116 -34
  76. package/sources/skills/mvt-design/manifest.yaml +96 -105
  77. package/sources/skills/mvt-fix/business.md +132 -28
  78. package/sources/skills/mvt-fix/manifest.yaml +85 -86
  79. package/sources/skills/mvt-help/business.md +74 -70
  80. package/sources/skills/mvt-help/manifest.yaml +67 -61
  81. package/sources/skills/mvt-implement/business.md +91 -32
  82. package/sources/skills/mvt-implement/manifest.yaml +80 -96
  83. package/sources/skills/mvt-init/business.md +164 -49
  84. package/sources/skills/mvt-init/manifest.yaml +101 -93
  85. package/sources/skills/mvt-manage-context/business.md +175 -0
  86. package/sources/skills/mvt-manage-context/manifest.yaml +123 -0
  87. package/sources/skills/mvt-plan-dev/business.md +75 -0
  88. package/sources/skills/mvt-plan-dev/manifest.yaml +91 -0
  89. package/sources/skills/mvt-quick-dev/business.md +99 -0
  90. package/sources/skills/mvt-quick-dev/manifest.yaml +69 -0
  91. package/sources/skills/mvt-refactor/business.md +104 -33
  92. package/sources/skills/mvt-refactor/manifest.yaml +86 -101
  93. package/sources/skills/mvt-resume/business.md +137 -0
  94. package/sources/skills/mvt-resume/manifest.yaml +71 -0
  95. package/sources/skills/mvt-review/business.md +112 -49
  96. package/sources/skills/mvt-review/manifest.yaml +87 -106
  97. package/sources/skills/mvt-status/business.md +71 -24
  98. package/sources/skills/mvt-status/manifest.yaml +66 -74
  99. package/sources/skills/mvt-sync-context/business.md +150 -25
  100. package/sources/skills/mvt-sync-context/manifest.yaml +96 -84
  101. package/sources/skills/mvt-template/business.md +96 -49
  102. package/sources/skills/mvt-template/manifest.yaml +63 -71
  103. package/sources/skills/mvt-test/business.md +104 -36
  104. package/sources/skills/mvt-test/manifest.yaml +102 -111
  105. package/sources/skills/mvt-update-plan/business.md +72 -0
  106. package/sources/skills/mvt-update-plan/manifest.yaml +132 -0
  107. package/sources/templates/analyze-output/body.md +15 -38
  108. package/sources/templates/analyze-output/manifest.yaml +11 -11
  109. package/sources/templates/design-output/body.md +17 -50
  110. package/sources/templates/design-output/manifest.yaml +11 -11
  111. package/sources/templates/implement-output/body.md +11 -32
  112. package/sources/templates/implement-output/manifest.yaml +11 -11
  113. package/sources/templates/project-context/body.md +13 -0
  114. package/sources/templates/project-context/manifest.yaml +12 -0
  115. package/sources/templates/review-output/body.md +11 -45
  116. package/sources/templates/review-output/manifest.yaml +11 -11
  117. package/sources/templates/test-output/body.md +7 -31
  118. package/sources/templates/test-output/manifest.yaml +11 -11
  119. package/dist/fs/protection.d.ts +0 -15
  120. package/dist/fs/protection.d.ts.map +0 -1
  121. package/dist/fs/protection.js +0 -16
  122. package/dist/fs/protection.js.map +0 -1
  123. package/sources/knowledge/core/review-principles.md +0 -51
  124. package/sources/knowledge/patterns/clean-architecture/manifest.yaml +0 -66
  125. package/sources/knowledge/patterns/clean-architecture/review-checklist.md +0 -230
  126. package/sources/knowledge/patterns/ddd/manifest.yaml +0 -83
  127. package/sources/knowledge/patterns/ddd/review-checklist.md +0 -226
  128. package/sources/knowledge/patterns/ddd/tactical-patterns.md +0 -12
  129. package/sources/knowledge/patterns/frontend-react/manifest.yaml +0 -44
  130. package/sources/knowledge/patterns/frontend-react/review-checklist.md +0 -78
  131. package/sources/knowledge/patterns/manifest.yaml +0 -113
  132. package/sources/skills/mvt-add-context/business.md +0 -47
  133. package/sources/skills/mvt-add-context/manifest.yaml +0 -83
  134. package/sources/templates/analyze-code-output/body.md +0 -44
  135. package/sources/templates/analyze-code-output/manifest.yaml +0 -11
  136. package/sources/templates/cleanup-output/body.md +0 -9
  137. package/sources/templates/cleanup-output/manifest.yaml +0 -11
  138. package/sources/templates/config-output/body.md +0 -11
  139. package/sources/templates/config-output/manifest.yaml +0 -11
  140. package/sources/templates/context-check-output/body.md +0 -32
  141. package/sources/templates/context-check-output/manifest.yaml +0 -11
  142. package/sources/templates/fix-output/body.md +0 -30
  143. package/sources/templates/fix-output/manifest.yaml +0 -11
  144. package/sources/templates/init-output/body.md +0 -34
  145. package/sources/templates/init-output/manifest.yaml +0 -11
  146. package/sources/templates/refactor-output/body.md +0 -32
  147. package/sources/templates/refactor-output/manifest.yaml +0 -11
  148. package/sources/templates/status-output/body.md +0 -36
  149. package/sources/templates/status-output/manifest.yaml +0 -11
  150. package/sources/templates/sync-context-output/body.md +0 -16
  151. package/sources/templates/sync-context-output/manifest.yaml +0 -11
@@ -1,35 +1,82 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Scan Codebase
4
- - Scan source directories (src/, lib/, app/, etc.)
5
- - Identify entry points
6
- - Map module/directory structure
7
-
8
- ### Step 2: Extract Entities
9
- - Find domain entities and models
10
- - Identify value objects
11
- - Map relationships between entities
12
-
13
- ### Step 3: Extract Services
14
- - Find service classes and modules
15
- - Identify API endpoints
16
- - Map dependency graph between services
17
-
18
- ### Step 4: Analyze Architecture
19
- - Detect architecture pattern (DDD, Clean Architecture, MVC, etc.)
20
- - Assess confidence level
21
- - Identify layer boundaries
22
-
23
- ### Step 5: Infer Requirements
24
- - Generate feature list from code functionality
25
- - Identify business rules from logic
26
- - Document inferred requirements with confidence levels
27
-
28
- ### Step 6: Update Workspace
29
- 1. Update `.ai-agents/workspace/project-context.yaml`:
30
- - Write detected architecture to `architecture` section
31
- - Write discovered modules, entities, services
32
- 2. Write artifact: `.ai-agents/workspace/artifacts/code-analysis/{timestamp}-analysis.md`
33
- 3. Update `.ai-agents/workspace/session.yaml`:
34
- - Set `session.last_command: "/mvt-analyze-code"`
35
- - Append one-line summary to `recent_actions` (keep max 3)
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Determine Analysis Target
4
+
5
+ Identify which project(s) to analyze:
6
+
7
+ | Variant | Target |
8
+ |---------|--------|
9
+ | `/mvt-analyze-code` | Analyze the first project in `project-context.yaml` (or the only one) |
10
+ | `/mvt-analyze-code --all` | Analyze all projects listed in `project-context.yaml` |
11
+ | `/mvt-analyze-code {name}` | Analyze the project matching the given name |
12
+
13
+ For each target project:
14
+ 1. Read its `path` from `project-context.yaml`
15
+ 2. Use `path` as the source directory for analysis
16
+
17
+ ### Step 2: Load Template
18
+
19
+ Determine the output template for project-context.md:
20
+
21
+ 1. Check `.ai-agents/skills/_templates/custom/project-context.md` -- if exists, use it
22
+ 2. Otherwise, use `.ai-agents/skills/_templates/project-context.md` (default)
23
+ 3. Read the template to understand the required section structure
24
+ 4. The template defines section headings only -- generate content freely for each section based on code analysis
25
+
26
+ ### Step 3: Scan Code Structure
27
+
28
+ For the target project directory:
29
+
30
+ - Map directory structure (one level below source root)
31
+ - Identify entry points (main files, index files, router files)
32
+ - Detect module boundaries (top-level directories under source root)
33
+
34
+ ### Step 4: Extract Modules and Entities
35
+
36
+ - Identify top-level modules and their responsibilities
37
+ - For each module, determine: path, responsibility, dependencies on other modules
38
+ - Identify domain entities (models, schemas, types, interfaces)
39
+ - Classify entities by type: domain model, value object, DTO, configuration
40
+
41
+ ### Step 5: Extract Core Terms
42
+
43
+ Scan code for domain-specific terminology:
44
+
45
+ - Class and interface names that represent domain concepts
46
+ - Abbreviations and their expansions
47
+ - Domain jargon used in comments and docstrings
48
+ - Present as a glossary table: | Term | Meaning |
49
+
50
+ ### Step 6: Extract Business Rules
51
+
52
+ Identify key business logic and constraints:
53
+
54
+ - Validation rules (assertions, guards, precondition checks)
55
+ - Computation rules (formulas, algorithms, calculation logic)
56
+ - State transition rules (workflow steps, status changes)
57
+ - Constraint rules (limits, quotas, access restrictions)
58
+
59
+ ### Step 7: Extract API Overview
60
+
61
+ Identify public interfaces:
62
+
63
+ - HTTP endpoints (routes, handlers) with method and path
64
+ - Public methods of service classes
65
+ - Event publishers and subscribers
66
+ - CLI commands (if applicable)
67
+
68
+ ### Step 8: Generate Output
69
+
70
+ 1. For each analyzed project, generate a section in the template format:
71
+ - Use `# Project: {name}` as the top-level heading
72
+ - Fill each template section with analysis results
73
+ - If a section has no relevant content, include the heading with "(No relevant content detected)"
74
+
75
+ 2. Write the output to `.ai-agents/knowledge/project/_generated/project-context.md`:
76
+ - If analyzing a single project, write that project's section
77
+ - If analyzing multiple projects (`--all`), write all sections separated by `---`
78
+ - If the file already exists, merge with existing content:
79
+ - Replace sections for re-analyzed projects
80
+ - Preserve sections for projects NOT in this analysis run
81
+
82
+ 3. Do NOT update `project-context.yaml` -- it is the lean index, managed by `/mvt-init` and `/mvt-sync-context` only
@@ -1,88 +1,96 @@
1
- name: mvt-analyze-code
2
- output: .claude/skills/mvt-analyze-code/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-analyze-code
6
- description: "Reverse-analyze existing code to generate context and infer requirements. Use when user wants to understand an existing codebase, generate documentation for legacy code, or onboard to a new project."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Analyze Code
12
-
13
- ## Purpose
14
-
15
- Reverse-analyze existing code to generate context, discover architecture, and infer requirements. Unlike `/mvt-analyze` which works from requirements documents, this skill works from source code. This is an independent operation that does not create a change-id.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Analyst
21
- role_desc: "a Requirements Analysis Expert"
22
- decision_rules:
23
- - rule: "Source code exists -> Proceed with codebase scanning"
24
- - rule: "No source code found -> Warn user and suggest checking project path"
25
- - rule: "Ambiguous architecture -> Present detected pattern with confidence level"
26
- - rule: "Multiple frameworks detected -> List all and ask user to confirm primary"
27
- boundaries:
28
- - scope: "make architecture decisions"
29
- skill: "/mvt-design"
30
- - scope: "recommend technologies"
31
- skill: "/mvt-design"
32
- - scope: "write implementation code"
33
- skill: "/mvt-implement"
34
-
35
- - type: shared
36
- source: sections/activation-load-context.md
37
- params:
38
- extended_context:
39
- - "Scan project source directories for analysis"
40
-
41
- - type: shared
42
- source: sections/activation-load-config.md
43
-
44
- - type: shared
45
- source: sections/activation-preflight.md
46
- params:
47
- checks:
48
- - order: "1"
49
- field: "session.initialized_at"
50
- level: "WARN"
51
- message: 'Session not initialized. Run `/mvt-init` first.'
52
-
53
- - type: inline
54
- content: |
55
- ### Independent Operation Rules
56
- - This is an independent operation -- no workflow prerequisites required
57
- - Does NOT create a change-id
58
- - Artifacts stored under `.ai-agents/workspace/artifacts/code-analysis/` instead of a change-id directory
59
-
60
- ### Step 4: Execute
61
- Proceed to Execution Flow below.
62
-
63
- - type: file
64
- source: ./business.md
65
-
66
- - type: inline
67
- content: |
68
- ## Output Format
69
-
70
- Read and use the output template from: `.ai-agents/skills/_templates/analyze-code-output.md`
71
-
72
- If a custom version exists at `.ai-agents/skills/_templates/custom/analyze-code-output.md`, use the custom version instead.
73
-
74
- Fill the template placeholders with the analysis results.
75
-
76
- Every response MUST end with a Suggested Next Steps section.
77
-
78
- - type: shared
79
- source: sections/footer-next-steps.md
80
- params:
81
- next_primary: mvt-analyze
82
- next_primary_desc: "Add requirements on top of discovered structure"
83
- next_alternatives:
84
- - skill: mvt-design
85
- when: "Design new features for existing architecture"
86
- always_show:
87
- - skill: mvt-status
88
- desc: "Check current project state"
1
+ name: mvt-analyze-code
2
+ output: .claude/skills/mvt-analyze-code/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-analyze-code
6
+ description: "Analyze existing code to generate project-context.md with terms, modules, layers, and business rules. This skill should be used when user wants to understand an existing codebase, generate documentation for legacy code, onboard to a new project, or extract requirements from source code."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Analyze Code
12
+
13
+ ## Purpose
14
+
15
+ Analyze existing code to generate the project-context.md file, which describes the project's terms, modules, layer structure, business rules, and API overview. This is an independent operation that does not create a change-id.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Analyst
21
+ role_desc: "a Code Analysis Expert"
22
+ decision_rules:
23
+ - rule: "Source code exists -> Proceed with codebase scanning"
24
+ - rule: "No source code found -> Warn user and suggest checking project path"
25
+ - rule: "Multiple frameworks detected -> List all and prompt for primary confirmation"
26
+ - rule: "Custom template exists -> Use it instead of default template"
27
+ boundaries:
28
+ - scope: "make architecture decisions"
29
+ skill: "/mvt-design"
30
+ - scope: "recommend technologies"
31
+ skill: "/mvt-design"
32
+ - scope: "write implementation code"
33
+ skill: "/mvt-implement"
34
+
35
+ - type: inline
36
+ content: |
37
+ ## Variants
38
+
39
+ | Variant | Description |
40
+ |---------|-------------|
41
+ | `/mvt-analyze-code` | Analyze the first (or only) project |
42
+ | `/mvt-analyze-code --all` | Analyze all projects in the workspace |
43
+ | `/mvt-analyze-code {name}` | Analyze a specific project by name |
44
+
45
+ - type: shared
46
+ source: sections/activation-load-context.md
47
+ params:
48
+ extended_context:
49
+ - "Scan project source directories for analysis"
50
+ - ".ai-agents/skills/_templates/project-context.md -- Default template for output structure"
51
+ - ".ai-agents/skills/_templates/custom/project-context.md -- Custom template (if exists)"
52
+
53
+ - type: shared
54
+ source: sections/activation-load-config.md
55
+
56
+ - type: shared
57
+ source: sections/output-language-constraint.md
58
+
59
+ - type: shared
60
+ source: sections/activation-preflight.md
61
+ params:
62
+ checks:
63
+ - order: "1"
64
+ field: "session.initialized_at"
65
+ level: "WARN"
66
+ message: "Session not initialized. Run `/mvt-init` first."
67
+ - order: "2"
68
+ field: "projects[] in project-context.yaml"
69
+ level: "WARN"
70
+ message: "No projects registered. Run `/mvt-init` first."
71
+
72
+ - type: inline
73
+ content: |
74
+ ### Independent Operation Rules
75
+ - This is an independent operation -- no workflow prerequisites required
76
+ - Does NOT create a change-id
77
+ - Output is written to `.ai-agents/knowledge/project/_generated/project-context.md`
78
+
79
+ - type: file
80
+ source: ./business.md
81
+
82
+ - type: inline
83
+ content: |
84
+ ## Artifact Structure
85
+ Read the document structure template from: `.ai-agents/skills/_templates/project-context.md`
86
+ If a custom version exists at `.ai-agents/skills/_templates/custom/project-context.md`, use the custom version instead.
87
+ The template defines section headings only. Generate content for each section based on code analysis results.
88
+ Write the artifact to: `.ai-agents/knowledge/project/_generated/project-context.md`
89
+
90
+ - type: shared
91
+ source: sections/session-update.md
92
+
93
+ - type: shared
94
+ source: sections/footer-next-steps.md
95
+ params:
96
+ current_skill: mvt-analyze-code
@@ -0,0 +1,101 @@
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Receive & Complete Input
4
+ - Read the user-provided bug description (free text, possibly with stack trace, error message, or reproduction steps).
5
+ - Assess input completeness using the table below:
6
+
7
+ | Input Situation | Action |
8
+ |-----------------|--------|
9
+ | No input provided | Present a structured template and wait. Template fields: **Error message**, **Reproduction steps**, **Expected behavior**, **Actual behavior**, **Environment** |
10
+ | Only error message | Ask: trigger conditions, runtime environment, recent changes |
11
+ | Only behavioral description (no error) | Ask: any error message available, whether it reproduces reliably, affected scope |
12
+ | Stack trace present | Sufficient — proceed to Step 2 |
13
+ | Reproduction steps + error message | Sufficient — proceed to Step 2 |
14
+
15
+ - When asking for clarification, be specific. Do NOT ask "can you provide more details?" — instead, name the exact missing dimension (e.g., "What error message do you see when this happens?").
16
+
17
+ ### Step 2: Signal Extraction & Localization
18
+ - Extract concrete signals from the bug description: error message text, stack trace frames, file paths, function/class names, input data.
19
+ - For each signal, locate matching code (Grep / Glob).
20
+ - Build a candidate file list with one-line justification per file.
21
+ - Read recent git state (`git diff HEAD`, `git log -n 10 --oneline`) to surface recent changes that may correlate with the issue.
22
+
23
+ ### Step 3: Reproduction Verification
24
+
25
+ | Condition | Action |
26
+ |-----------|--------|
27
+ | Reproduction steps provided → successfully reproduced | Mark as `Verified`, capture observed vs expected behavior |
28
+ | Reproduction steps provided → cannot reproduce | Mark as `Unverified`, continue with static analysis only |
29
+ | No reproduction steps, but signals are concrete (stack trace + paths) | Continue with static analysis, mark as `Static-only` |
30
+ | No reproduction steps, signals are vague | STOP — ask user for: minimal reproduction, exact error, environment, last-known-good version |
31
+
32
+ ### Step 4: Root Cause Analysis
33
+ - Generate 1-5 candidate root cause hypotheses based on the dominant signal:
34
+
35
+ | Dominant Signal | Hypothesis Sources |
36
+ |-----------------|--------------------|
37
+ | Stack trace | Top frame in user code, recently changed code in any frame, null/undefined origin, type mismatch at boundary |
38
+ | Error message | Exact-string search in repo, typed exception class hierarchy, library docs for that error |
39
+ | Recent git diff | Files changed in last N commits intersecting with localized files, commit messages mentioning related modules |
40
+ | Behavioral description (no error) | Module boundary mismatches, off-by-one / null-handling, async/race, state leakage, configuration drift |
41
+
42
+ - Each hypothesis must be written as: `<claim> -- evidence: <pointer> -- check: <how to verify>`.
43
+ - Verify hypotheses from cheapest check to most expensive. Eliminate hypotheses that fail their checks.
44
+ - If ALL hypotheses are eliminated — STOP, surface findings, request more info from user. Do NOT fabricate new hypotheses silently.
45
+
46
+ ### Step 5: Impact Assessment & Classification
47
+
48
+ **Bug Confirmation Status:**
49
+
50
+ | Status | Meaning |
51
+ |--------|---------|
52
+ | Confirmed | Root cause verified, bug definitely exists |
53
+ | Likely | Evidence is strong but cannot fully rule out other possibilities |
54
+ | NotABug | Actual behavior matches expected behavior / business rules — not a bug |
55
+ | Inconclusive | Insufficient evidence, requires human judgment |
56
+
57
+ **Severity:**
58
+
59
+ | Level | Definition |
60
+ |-------|------------|
61
+ | Critical | Data loss, security vulnerability, core functionality broken |
62
+ | High | Major feature broken but temporary workaround exists |
63
+ | Medium | Minor feature broken or usability issue |
64
+ | Low | Edge case issue, no significant impact on main flow |
65
+
66
+ **Impact Scope:**
67
+ - List affected modules/files with one-line description each.
68
+ - List affected user scenarios / business flows.
69
+ - Search for similar patterns elsewhere in the codebase (same root cause may exist in other locations).
70
+
71
+ ### Step 6: Present Diagnosis
72
+ - Output the diagnosis in conversation using this format:
73
+
74
+ ```
75
+ Bug Detection Result
76
+ ─────────────────────
77
+ Status: <Confirmed | Likely | NotABug | Inconclusive>
78
+ Severity: <Critical | High | Medium | Low>
79
+ Root Cause: <one paragraph>
80
+ Confidence: <reasoning for the status judgment>
81
+ Impact: <affected modules and scenarios>
82
+ Affected: <file list with line ranges>
83
+ Similar: <other locations that may have the same root cause>
84
+ ─────────────────────
85
+ ```
86
+
87
+ - For `NotABug`: explain why the current behavior is expected, and suggest `/mvt-analyze` if the requirement itself needs revision.
88
+ - For `Inconclusive`: summarize what was found and what remains unknown, so the user or `/mvt-fix` can act with full awareness.
89
+
90
+ ### Step 7: (session update handled by shared section)
91
+
92
+ ## Edge Cases & Errors
93
+
94
+ | Case | Handling |
95
+ |------|----------|
96
+ | Bug is intermittent / racy | Mark reproduction as "flaky", state confidence level explicitly, suggest adding instrumentation rather than speculative analysis |
97
+ | Root cause is in a third-party dependency | Document the upstream issue, note that local workaround would be the only fix option |
98
+ | Bug description describes expected behavior (NotABug) | Explain clearly with evidence from code/business rules, do NOT proceed to suggest fixes |
99
+ | Multiple independent bugs described in one input | Analyze each separately, present multiple diagnosis blocks |
100
+ | User provides a URL or external reference | Note it but do NOT fetch external resources; work only with local code and the description text |
101
+ | `active_change` is missing | Run without change context (shortcut mode); omit change-id references in output |
@@ -0,0 +1,84 @@
1
+ name: mvt-bug-detect
2
+ output: .claude/skills/mvt-bug-detect/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-bug-detect
6
+ description: "Analyze and detect bugs by investigating root cause, assessing severity and impact scope. Produces a structured diagnosis in conversation without applying fixes. This skill should be used when user suspects a bug, wants to understand a problem before fixing, or needs impact analysis."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Bug Detect
12
+
13
+ ## Purpose
14
+
15
+ Investigate suspected bugs: confirm whether the bug exists, identify root cause, assess severity and impact scope, and produce a structured diagnosis. This skill does NOT apply fixes — it provides analysis to help the user understand the problem and decide on next steps.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Analyst
21
+ role_desc: "a Bug Investigation Specialist"
22
+ decision_rules:
23
+ - rule: "Bug description provided -> Analyze and investigate"
24
+ - rule: "Input too vague -> Prompt for specific details with structured template"
25
+ - rule: "No input -> Provide input template and wait"
26
+ - rule: "Root cause confirmed -> Assess impact and produce diagnosis"
27
+ - rule: "Multiple possible causes -> List hypotheses with evidence, verify each"
28
+ - rule: "Bug does not exist (expected behavior) -> Report clearly, suggest /mvt-analyze if requirement gap"
29
+ - rule: "Evidence insufficient -> Report findings, request more info, do NOT fabricate hypotheses"
30
+ boundaries:
31
+ - scope: "apply fixes"
32
+ skill: "/mvt-fix"
33
+ - scope: "design architecture"
34
+ skill: "/mvt-design"
35
+ - scope: "review code quality"
36
+ skill: "/mvt-review"
37
+
38
+ - type: shared
39
+ source: sections/activation-load-context.md
40
+ params:
41
+ extended_context:
42
+ - "Related source files (load based on bug description signals)"
43
+
44
+ - type: shared
45
+ source: sections/activation-load-config.md
46
+
47
+ - type: shared
48
+ source: sections/output-language-constraint.md
49
+
50
+ - type: inline
51
+ content: |
52
+ ### Shortcut Operation Rules
53
+ - Can execute at any time without checking workflow prerequisites
54
+ - Do NOT update `progress` (this is a shortcut operation, not a workflow phase)
55
+ - Do NOT write any artifact — diagnosis is presented in conversation only
56
+ - Do NOT modify any source code — this skill is read-only analysis
57
+
58
+ - type: file
59
+ source: ./business.md
60
+
61
+ - type: shared
62
+ source: sections/session-update.md
63
+
64
+ - type: shared
65
+ source: sections/footer-next-steps.md
66
+ params:
67
+ current_skill: mvt-bug-detect
68
+ conditional_suggestions:
69
+ conditions:
70
+ - condition: "bug confirmed, fix is straightforward"
71
+ primary: "mvt-fix"
72
+ primary_desc: "Fix this bug"
73
+ - condition: "bug confirmed, fix requires architecture change"
74
+ primary: "mvt-design"
75
+ primary_desc: "Design architectural solution first"
76
+ alternatives:
77
+ - skill: "mvt-fix"
78
+ desc: "Apply a minimal workaround"
79
+ - condition: "not a bug (expected behavior)"
80
+ primary: "mvt-analyze"
81
+ primary_desc: "Re-analyze the underlying requirement"
82
+ - condition: "inconclusive, needs deeper code understanding"
83
+ primary: "mvt-analyze-code"
84
+ primary_desc: "Deep-dive into the codebase"
@@ -1,42 +1,89 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Scan Context Files
4
- Scan all files that MVTT may load during operation:
5
-
6
- **Core files** (always loaded):
7
- - `.ai-agents/workspace/session.yaml`
8
- - `.ai-agents/workspace/project-context.yaml`
9
- - `.ai-agents/config.yaml`
10
-
11
- **Knowledge files** (loaded per config):
12
- - `.ai-agents/knowledge/core/`
13
- - `.ai-agents/knowledge/patterns/{active}/`
14
- - `.ai-agents/knowledge/principle/`
15
- - `.ai-agents/knowledge/project/`
16
-
17
- **Artifact files**:
18
- - `.ai-agents/workspace/artifacts/` (all subdirectories)
19
-
20
- **Skill files**:
21
- - `.claude/skills/mvt-*/SKILL.md` (all skill definitions)
22
-
23
- ### Step 2: Estimate Token Consumption
24
- - Calculate approximate tokens for each file: `characters / 4`
25
- - Group by category:
26
- - Core (session + context + config)
27
- - Knowledge (knowledge/)
28
- - Artifacts (artifacts/)
29
- - Skills (skills/)
30
- - Sum totals per category and overall
31
-
32
- ### Step 3: Assess and Recommend
33
- - Determine health status based on total tokens
34
- - Identify Top 5 largest files
35
- - Generate optimization recommendations:
36
- - Oversized project-context.yaml -> Suggest trimming
37
- - Too many old artifacts -> Suggest `/mvt-cleanup`
38
- - Unused knowledge files -> Suggest removal or lazy_load
39
- - Redundant information -> Suggest consolidation
40
- - Each recommendation should be specific and actionable
41
-
42
- ### Step 4: Generate Report
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Recommended**:
5
+ - `.ai-agents/knowledge/core/manifest.yaml` -- to filter `core/_framework/` (excluded) from `core/user/` (in-scope).
6
+ - **Fallback**: missing `core/manifest.yaml` -> treat all `core/*` files as user-origin (over-counts; flag in report).
7
+
8
+ ### Step 2: Determine In-Scope Files
9
+ This skill measures only files the **user** can reduce or relocate. Framework-fixed overhead is excluded.
10
+
11
+ **In scope (user-actionable):**
12
+ - Index: `.ai-agents/workspace/project-context.yaml`.
13
+ - Semantic context: `.ai-agents/knowledge/project/_generated/project-context.md`.
14
+ - Shared knowledge: every entry in `registry.yaml > knowledge.shared`. For the `core` entry, scan only files marked as user-origin per `core/manifest.yaml` (or whose path begins with `user/`); skip files under `core/_framework/`.
15
+ - Per-skill knowledge: every entry in `registry.yaml > skills.*.knowledge`, grouped by skill.
16
+ - Artifacts: all files under `.ai-agents/workspace/artifacts/` recursively.
17
+
18
+ **Out of scope (do NOT scan):**
19
+ - `.claude/skills/mvt-*/SKILL.md` -- framework-shipped, not user-editable.
20
+ - `.ai-agents/knowledge/core/_framework/**` -- framework-shipped.
21
+ - `.ai-agents/config.yaml`, `.ai-agents/workspace/session.yaml`, `.ai-agents/registry.yaml` -- small, required, and addressed via `/mvt-config` or `/mvt-manage-context`, not here.
22
+
23
+ ### Step 3: Estimate Token Consumption
24
+ - **What**: produce a per-file tokens estimate and per-category subtotals.
25
+ - **How**:
26
+ 1. For each in-scope file: tokens ~= `characters / 4`.
27
+ 2. Group by category: `Index`, `Semantic Context`, `Shared Knowledge`, `Per-Skill Knowledge`, `Artifacts`.
28
+ 3. For Shared Knowledge, compute total once -- this is per-skill overhead (loaded by every skill invocation).
29
+ 4. For Per-Skill Knowledge, compute totals per skill so users can see which skill is heaviest.
30
+ 5. Identify the Top 5 largest single files across the whole in-scope set.
31
+
32
+ ### Step 4: Apply Thresholds and Health Status
33
+ - **What**: assign each file/category a status of `healthy | borderline | oversized`.
34
+ - **How**: read thresholds from `.ai-agents/config.yaml > preferences.context_thresholds.*` if present; otherwise use the defaults below.
35
+
36
+ | Subject | healthy | borderline | oversized |
37
+ |---------|---------|------------|-----------|
38
+ | Total in-scope tokens | <= 12000 | 12001-25000 | > 25000 |
39
+ | Single file tokens | <= 3000 | 3001-6000 | > 6000 |
40
+ | `project-context.md` tokens | <= 4000 | 4001-8000 | > 8000 |
41
+ | Shared Knowledge total tokens | <= 6000 | 6001-12000 | > 12000 |
42
+ | Single change-id artifacts directory tokens | <= 3000 | 3001-8000 | > 8000 |
43
+
44
+ - Overall workspace status = the worst status across all subjects above.
45
+
46
+ ### Step 5: Generate Recommendations
47
+ - **What**: produce a list of specific, actionable recommendations. Each entry is `(trigger, message, suggested skill)`.
48
+ - **How**: walk the table; emit a recommendation for every row whose trigger fires.
49
+
50
+ | Trigger | Message template | Suggested skill |
51
+ |---------|------------------|-----------------|
52
+ | `project-context.md` is `oversized` | "project-context.md is {N} tokens. Regenerate with leaner sections." | `/mvt-analyze-code` |
53
+ | `project-context.md` is `borderline` AND last `/mvt-analyze-code` ran > 30 days ago | "project-context.md is {N} tokens and may be stale. Consider regenerating." | `/mvt-analyze-code` |
54
+ | Total artifacts tokens > artifacts threshold OR > 3 completed changes still in `artifacts/` | "Workspace has {N} tokens of historical artifacts. Archive completed changes." | `/mvt-cleanup` |
55
+ | A specific change-id directory is `oversized` | "artifacts/{id} alone is {N} tokens. Summarize this change." | `/mvt-cleanup` |
56
+ | Shared Knowledge total is `oversized` | "Shared knowledge totals {N} tokens (loaded by every skill). Move skill-specific entries to per-skill." | `/mvt-manage-context move` |
57
+ | A single Shared Knowledge file is `oversized` | "{path} is {N} tokens. Split or move to per-skill." | `/mvt-manage-context move` |
58
+ | Per-skill Knowledge entry exists in `registry.yaml` but its referenced files are missing | "{skill} declares knowledge `{id}` but `{path}` is missing." | `/mvt-manage-context remove` (or restore the file) |
59
+ | A knowledge file exists on disk but no `registry.yaml` entry references it | "{path} is unused (not loaded by any skill)." | `/mvt-manage-context remove` |
60
+ | Two knowledge entries reference identical content (same hash) | "{a} and {b} are duplicates. Consolidate." | manual edit |
61
+
62
+ - **Constraints on recommendations**:
63
+ - Never recommend changes to framework files (`_framework/`, `mvt-*/SKILL.md`).
64
+ - Never recommend deletion without an `/mvt-manage-context` or `/mvt-cleanup` command -- those skills own the actual mutation.
65
+ - If no triggers fire, return a single line: "Workspace context is healthy ({N} tokens total)."
66
+
67
+ ### Step 6: Generate Report
68
+ - Render the report in this order:
69
+ 1. **Summary** -- one line: total tokens + overall status.
70
+ 2. **Per-Category Breakdown** -- table: `category | files | tokens | status`.
71
+ 3. **Top 5 Largest Files** -- table: `path | tokens | category | status`.
72
+ 4. **Per-Skill Knowledge Cost** -- table: `skill | tokens` (sorted desc); include shared knowledge as a separate row labeled `(shared, loaded every time)`.
73
+ 5. **Recommendations** -- numbered list from Step 5; if empty, render the healthy line.
74
+ 6. **Excluded Scope Note** -- one paragraph reminding the user that framework files (`_framework/`, `mvt-*/SKILL.md`, `config.yaml`, `session.yaml`, `registry.yaml`) were not measured here.
75
+ - The report is conversation output; this skill does NOT write any artifact.
76
+
77
+ ### Step 7: (session update handled by shared section)
78
+
79
+ ## Edge Cases & Errors
80
+
81
+ | Case | Handling |
82
+ |------|----------|
83
+ | `registry.yaml` references a knowledge id whose source path is empty / missing | Include in Step 5 recommendations; do NOT count missing files toward token totals |
84
+ | `core/manifest.yaml` cannot be parsed | Treat the whole `core/` tree as in-scope (over-counts); add a note in the report |
85
+ | Workspace has zero artifacts | Skip the artifacts category in Step 6; do not error |
86
+ | Workspace exceeds the artifacts threshold AND the user just ran `/mvt-cleanup` (within last hour per `skill_history`) | Surface but downgrade to a one-line note ("recently cleaned -- remaining {N} tokens are likely active work") |
87
+ | User passes a path argument | This skill ignores arguments; print a one-line note and run as normal (do not narrow scope to a single file -- that is `/mvt-status` territory) |
88
+ | Token estimate disagrees with model's actual consumption | This is expected; the `chars/4` heuristic is an approximation. State this caveat in the Summary line |
89
+ | Two skills declare the same knowledge id | Count the file once for storage but report it under both skills in the Per-Skill table; flag the duplication in Step 5 |