@uoyo/mvtt 2.0.0-beta.1 → 2.0.0-beta.3

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 (84) hide show
  1. package/README.md +184 -193
  2. package/dist/build/section-loader.d.ts.map +1 -1
  3. package/dist/build/section-loader.js +18 -8
  4. package/dist/build/section-loader.js.map +1 -1
  5. package/dist/fs/materialize.d.ts.map +1 -1
  6. package/dist/fs/materialize.js +5 -0
  7. package/dist/fs/materialize.js.map +1 -1
  8. package/dist/scripts/session-update.cjs +7568 -0
  9. package/install-manifest.yaml +2 -0
  10. package/package.json +3 -2
  11. package/registry.yaml +6 -0
  12. package/sources/defaults/config.yaml +7 -7
  13. package/sources/defaults/session.yaml +9 -16
  14. package/sources/scripts/session-update.js +351 -0
  15. package/sources/sections/activation-load-context.md +4 -0
  16. package/sources/sections/footer-next-steps.md +1 -1
  17. package/sources/sections/output-language-constraint.md +11 -11
  18. package/sources/sections/session-update.md +115 -47
  19. package/sources/skills/mvt-analyze/business.md +7 -7
  20. package/sources/skills/mvt-analyze/manifest.yaml +1 -0
  21. package/sources/skills/mvt-analyze-code/manifest.yaml +110 -96
  22. package/sources/skills/mvt-bug-detect/business.md +99 -0
  23. package/sources/skills/mvt-bug-detect/manifest.yaml +84 -0
  24. package/sources/skills/mvt-check-context/business.md +3 -5
  25. package/sources/skills/mvt-check-context/manifest.yaml +70 -63
  26. package/sources/skills/mvt-cleanup/business.md +49 -23
  27. package/sources/skills/mvt-cleanup/manifest.yaml +15 -10
  28. package/sources/skills/mvt-config/business.md +1 -2
  29. package/sources/skills/mvt-config/manifest.yaml +103 -96
  30. package/sources/skills/mvt-create-skill/business.md +84 -76
  31. package/sources/skills/mvt-create-skill/manifest.yaml +107 -95
  32. package/sources/skills/mvt-design/business.md +3 -6
  33. package/sources/skills/mvt-design/manifest.yaml +109 -96
  34. package/sources/skills/mvt-fix/business.md +39 -9
  35. package/sources/skills/mvt-fix/manifest.yaml +88 -72
  36. package/sources/skills/mvt-help/business.md +2 -4
  37. package/sources/skills/mvt-help/manifest.yaml +75 -67
  38. package/sources/skills/mvt-implement/business.md +4 -5
  39. package/sources/skills/mvt-implement/manifest.yaml +93 -80
  40. package/sources/skills/mvt-init/business.md +2 -2
  41. package/sources/skills/mvt-init/manifest.yaml +102 -101
  42. package/sources/skills/mvt-manage-context/business.md +186 -175
  43. package/sources/skills/mvt-manage-context/manifest.yaml +134 -123
  44. package/sources/skills/mvt-plan-dev/business.md +101 -20
  45. package/sources/skills/mvt-plan-dev/manifest.yaml +90 -91
  46. package/sources/skills/mvt-quick-dev/business.md +2 -1
  47. package/sources/skills/mvt-quick-dev/manifest.yaml +84 -69
  48. package/sources/skills/mvt-refactor/business.md +2 -1
  49. package/sources/skills/mvt-refactor/manifest.yaml +104 -86
  50. package/sources/skills/mvt-resume/business.md +28 -68
  51. package/sources/skills/mvt-resume/manifest.yaml +81 -71
  52. package/sources/skills/mvt-review/business.md +3 -3
  53. package/sources/skills/mvt-review/manifest.yaml +108 -87
  54. package/sources/skills/mvt-status/business.md +14 -18
  55. package/sources/skills/mvt-status/manifest.yaml +74 -66
  56. package/sources/skills/mvt-sync-context/business.md +155 -150
  57. package/sources/skills/mvt-sync-context/manifest.yaml +99 -96
  58. package/sources/skills/mvt-template/business.md +0 -2
  59. package/sources/skills/mvt-template/manifest.yaml +68 -63
  60. package/sources/skills/mvt-test/business.md +3 -3
  61. package/sources/skills/mvt-test/manifest.yaml +115 -102
  62. package/sources/skills/mvt-update-plan/business.md +83 -72
  63. package/sources/skills/mvt-update-plan/manifest.yaml +124 -132
  64. package/sources/templates/analyze-output/body.md +15 -15
  65. package/sources/templates/design-output/body.md +17 -17
  66. package/sources/templates/implement-output/body.md +11 -11
  67. package/sources/templates/review-output/body.md +11 -11
  68. package/sources/templates/test-output/body.md +7 -7
  69. package/dist/build/plan-validator.d.ts +0 -26
  70. package/dist/build/plan-validator.d.ts.map +0 -1
  71. package/dist/build/plan-validator.js +0 -225
  72. package/dist/build/plan-validator.js.map +0 -1
  73. package/dist/commands/build.d.ts +0 -5
  74. package/dist/commands/build.d.ts.map +0 -1
  75. package/dist/commands/build.js +0 -46
  76. package/dist/commands/build.js.map +0 -1
  77. package/dist/commands/migrate.d.ts +0 -18
  78. package/dist/commands/migrate.d.ts.map +0 -1
  79. package/dist/commands/migrate.js +0 -163
  80. package/dist/commands/migrate.js.map +0 -1
  81. package/dist/fs/protection.d.ts +0 -15
  82. package/dist/fs/protection.d.ts.map +0 -1
  83. package/dist/fs/protection.js +0 -16
  84. package/dist/fs/protection.js.map +0 -1
@@ -1,47 +1,115 @@
1
- {{?read_only}}
2
- ## State Update
3
-
4
- This skill is read-only and does NOT modify `.ai-agents/workspace/session.yaml`. No state mutation, no `skill_history` append, no `recent_actions` append.
5
- {{/read_only}}
6
- {{^read_only}}
7
- ## State Update (Required)
8
-
9
- After execution, update `.ai-agents/workspace/session.yaml` with the following fields.
10
-
11
- ### Mandatory (every skill must set)
12
-
13
- - `session.last_command`: Set to the current skill command (e.g., `"/mvt-analyze"`)
14
- - `skill_history`: Append entry:
15
- ```yaml
16
- - command: "/{skill-name}"
17
- completed_at: "{current timestamp ISO 8601}"
18
- summary: "{one-line summary of what was accomplished}"
19
- change_id: "{active_change.id if set, otherwise empty string}"
20
- ```
21
- Keep max 10 entries. If exceeds, drop the oldest. The `change_id` field enables `/mvt-resume` to filter history per change when multiple changes are in flight.
22
- - `recent_actions`: Append one-line summary with format:
23
- `[{YYYY-MM-DD HH:MM}] /{command}: {one-line summary}`
24
- Keep max 5 entries. If exceeds, drop the oldest.
25
- {{#update_active_change}}
26
-
27
- ### Conditional (set only when applicable)
28
-
29
- - `active_change.id`: Set when this skill creates a new change
30
- - `active_change.title`: Set when this skill creates a new change
31
- - `active_change.created_at`: Set when this skill creates a new change
32
- {{/update_active_change}}
33
- {{#update_initialized_at}}
34
-
35
- ### Conditional (set only when applicable)
36
-
37
- - `session.initialized_at`: Set to current timestamp when this skill initializes the project
38
- {{/update_initialized_at}}
39
-
40
- ### Forbidden
41
-
42
- - Do NOT update fields not listed above
43
- - Do NOT overwrite `active_change` unless this skill creates a new change
44
- - Do NOT modify `skill_history` entries other than appending a new one
45
- - Do NOT modify `recent_changes` -- it is owned by `/mvt-plan-dev` and `/mvt-update-plan`
46
- - Do NOT modify `active_change.plan_path` or `active_change.has_plan` -- these are owned by `/mvt-plan-dev`
47
- {{/read_only}}
1
+ {{?read_only}}
2
+ ## State Update
3
+
4
+ This skill is read-only and does NOT modify `.ai-agents/workspace/session.yaml`.
5
+ {{/read_only}}
6
+ {{^read_only}}
7
+ ## State Update
8
+
9
+ After completing the skill's main task, run the session update script **exactly once** with the following arguments:
10
+
11
+ ```bash
12
+ node .ai-agents/scripts/session-update.cjs --skill <skill_command_name> --summary "<concise one-line summary>"{{#update_active_change}} --new-change "<active_change.title>" --change-id <active_change.id>{{/update_active_change}}{{#set_plan_path}} --set-plan-path ".ai-agents/workspace/artifacts/{active_change.id}/plan.yaml"{{/set_plan_path}}{{#update_change}} --update-change{{/update_change}}{{#close_change}} --close-change{{/close_change}}{{#set_change_status}} --set-change-status <status>{{/set_change_status}}{{#no_change}} --no-change{{/no_change}}{{#set_synced}} --set-synced{{/set_synced}}{{#truncate_history}} --truncate-history <count>{{/truncate_history}}{{#update_initialized_at}} --set-initialized{{/update_initialized_at}}
13
+
14
+ ```
15
+
16
+ If the script exits with code 0, the state update was applied successfully; there is no need to read or verify the session file.
17
+
18
+ ### Argument values
19
+
20
+ | Argument | Value source | Example |
21
+ |----------|-------------|---------|
22
+ | `--skill` | The exact skill command name without the leading `/` | `{{current_skill}}` |
23
+ | `--summary` | A concise one-line description of what this invocation accomplished, in the configured `interaction_language` | `"Identified auth requirements and created change chg-001"` |
24
+ {{#update_active_change}}
25
+ | `--new-change` | The title of the new change being created (same value written to `active_change.title`) | `"User authentication system"` |
26
+ | `--change-id` | The unique identifier of the new change (same value written to `active_change.id`) | `chg-001` |
27
+ {{/update_active_change}}
28
+ {{#set_plan_path}}
29
+ | `--set-plan-path` | The path to the newly created plan.yaml | `".ai-agents/workspace/artifacts/chg-001/plan.yaml"` |
30
+ {{/set_plan_path}}
31
+ {{#update_change}}
32
+ | `--update-change` | Flag only, no value. Upserts the current `active_change` into `changes[]`. | — |
33
+ {{/update_change}}
34
+ {{#close_change}}
35
+ | `--close-change` | Flag only, no value. Snapshots `active_change` into `changes[]` with `status: done`, then clears `active_change`. | — |
36
+ {{/close_change}}
37
+ {{#set_change_status}}
38
+ | `--set-change-status` | The status to set on the `changes[]` entry matching `active_change.id`. Values: `active`, `done`, `abandoned`. | `done` |
39
+ {{/set_change_status}}
40
+ {{#no_change}}
41
+ | `--no-change` | Flag only, no value. Forces `history[].change_id` to empty string (skips `active_change.id` fallback). | — |
42
+ {{/no_change}}
43
+ {{#set_synced}}
44
+ | `--set-synced` | Flag only, no value. Sets `session.last_synced_at` to current time. | |
45
+ {{/set_synced}}
46
+ {{#truncate_history}}
47
+ | `--truncate-history` | Number of most recent history entries to keep (read from `config.yaml > preferences.history_limits.history`, default 20); older entries are discarded. | `20` |
48
+ {{/truncate_history}}
49
+ {{#update_initialized_at}}
50
+ | `--set-initialized` | Flag only, no value. Set when this skill initializes the project for the first time. | — |
51
+ {{/update_initialized_at}}
52
+
53
+ {{#update_active_change}}
54
+ ### Parameter semantics
55
+
56
+ | Argument | When to use | Effect on `session.yaml` |
57
+ |----------|-------------|--------------------------|
58
+ | `--new-change` + `--change-id` | Skill creates or identifies a new change | Sets `active_change.id`, `.title`, `.created_at`. Auto-snapshots old `active_change` into `changes[]` if non-empty. Requires both arguments together. |
59
+ {{#set_plan_path}}
60
+ | `--set-plan-path` | Skill creates a new `plan.yaml` for the active change | Sets `active_change.plan_path`. Must be used together with `--update-change`. |
61
+ {{/set_plan_path}}
62
+ {{#update_change}}
63
+ | `--update-change` | Skill creates or modifies a plan (i.e., after `plan.yaml` is written/updated) | Upserts current `active_change` into `changes[]` (with `status: active`), sets `updated_at`, sorts ascending, truncates to configured limit. |
64
+ {{/update_change}}
65
+ {{#close_change}}
66
+ | `--close-change` | All plan tasks are completed | Snapshots `active_change` into `changes[]` with `status: done`, then clears all `active_change` fields. |
67
+ {{/close_change}}
68
+ {{#set_change_status}}
69
+ | `--set-change-status` | Explicitly mark a change as `done` or `abandoned` | Sets `status` on the `changes[]` entry whose `id` matches `active_change.id`. |
70
+ {{/set_change_status}}
71
+ {{#no_change}}
72
+ | `--no-change` | Skill should not be associated with any change | Forces `history[].change_id` to empty string, skipping the `active_change.id` fallback. |
73
+ {{/no_change}}
74
+ {{#set_synced}}
75
+ | `--set-synced` | Skill synchronizes context files | Sets `session.last_synced_at` to the current time. |
76
+ {{/set_synced}}
77
+ {{#truncate_history}}
78
+ | `--truncate-history` | Maintenance: trim old history entries | Keeps the most recent N entries in `history[]`, discards older ones. |
79
+ {{/truncate_history}}
80
+ {{#update_initialized_at}}
81
+ | `--set-initialized` | Skill initializes the project for the first time | Sets `session.initialized_at` (idempotent — only writes if empty). |
82
+ {{/update_initialized_at}}
83
+ {{/update_active_change}}
84
+ {{^update_active_change}}
85
+ ### Parameter semantics
86
+
87
+ | Argument | When to use | Effect on `session.yaml` |
88
+ |----------|-------------|--------------------------|
89
+ {{#update_change}}
90
+ | `--update-change` | Skill modifies a plan (i.e., after `plan.yaml` is updated) | Upserts current `active_change` into `changes[]` (with `status: active`), sets `updated_at`, sorts ascending, truncates to configured limit. |
91
+ {{/update_change}}
92
+ {{#close_change}}
93
+ | `--close-change` | All plan tasks are completed | Snapshots `active_change` into `changes[]` with `status: done`, then clears all `active_change` fields. |
94
+ {{/close_change}}
95
+ {{#set_change_status}}
96
+ | `--set-change-status` | Explicitly mark a change as `done` or `abandoned` | Sets `status` on the `changes[]` entry whose `id` matches `active_change.id`. |
97
+ {{/set_change_status}}
98
+ {{#no_change}}
99
+ | `--no-change` | Skill should not be associated with any change | Forces `history[].change_id` to empty string, skipping the `active_change.id` fallback. |
100
+ {{/no_change}}
101
+ {{#set_synced}}
102
+ | `--set-synced` | Skill synchronizes context files | Sets `session.last_synced_at` to the current time. |
103
+ {{/set_synced}}
104
+ {{#truncate_history}}
105
+ | `--truncate-history` | Maintenance: trim old history entries | Keeps the most recent N entries in `history[]`, discards older ones. |
106
+ {{/truncate_history}}
107
+ {{#update_initialized_at}}
108
+ | `--set-initialized` | Skill initializes the project for the first time | Sets `session.initialized_at` (idempotent — only writes if empty). |
109
+ {{/update_initialized_at}}
110
+ {{/update_active_change}}
111
+
112
+ ### Failure handling
113
+
114
+ If the script fails (non-zero exit), do NOT abort the skill's main task. Continue execution and add a brief note at the end of your response that the session could not be updated.
115
+ {{/read_only}}
@@ -10,7 +10,7 @@
10
10
  - Extract business rules and constraints
11
11
  - Note assumptions made
12
12
 
13
- ### Step 2.5: Assess Complexity (Quick Path Detection)
13
+ ### Step 3: Assess Complexity (Quick Path Detection)
14
14
  - **What**: evaluate whether this requirement qualifies as a simple change suitable for the quick development path via `/mvt-quick-dev`.
15
15
  - **How**: check each criterion in the table below. ALL criteria must pass for the quick path to be offered.
16
16
 
@@ -40,30 +40,30 @@
40
40
  - Scope: ✗ touches auth middleware, user model, login UI, OAuth callback handler, config (5+ files)
41
41
  - No new concepts: ✗ introduces external IdP and OAuth callback contract
42
42
  - No integration concerns: ✗ new external dependency (Google IdP)
43
- → Proceed with standard analysis flow (Steps 3-5).
43
+ → Proceed with standard analysis flow (Steps 4-6).
44
44
 
45
45
  - **Branches**:
46
46
 
47
47
  | Condition | Action |
48
48
  |-----------|--------|
49
49
  | ALL criteria pass | Ask user: "This appears to be a simple change (1-3 files, no architectural impact). Use /mvt-quick-dev for faster execution? (y / n / show-criteria)" |
50
- | ANY criterion fails | Proceed with standard analysis flow (Steps 3-5) |
50
+ | ANY criterion fails | Proceed with standard analysis flow (Steps 4-6) |
51
51
  | Ambiguous (2-3 criteria unclear) | Proceed with standard analysis; do NOT offer quick path |
52
52
 
53
53
  - **On user choice**:
54
54
  - "y" -- Do NOT write an analysis artifact. Summarize the requirement understanding in conversation and recommend `/mvt-quick-dev` directly. Set `active_change` if one doesn't exist, so `/mvt-quick-dev` can reference the current work context.
55
- - "n" -- Continue with full analysis flow (Steps 3-5).
55
+ - "n" -- Continue with full analysis flow (Steps 4-6).
56
56
  - "show-criteria" -- Display the assessment results (pass/fail per criterion), then re-prompt with y/n.
57
57
 
58
- ### Step 3: Detect Ambiguities
58
+ ### Step 4: Detect Ambiguities
59
59
  - Check for unclear requirements
60
60
  - Check for missing information
61
61
  - Check for conflicting requirements
62
62
 
63
- ### Step 4: Generate Clarification Questions
63
+ ### Step 5: Generate Clarification Questions
64
64
  - If ambiguities found -> List each with specific question, prioritized by impact
65
65
  - If no ambiguities -> Skip this step
66
66
 
67
- ### Step 5: Update Workspace
67
+ ### Step 6: Update Workspace
68
68
  1. Generate change-id: `{YYYYMMDD}-{slug}` format (e.g., `20260425-user-authentication`)
69
69
  2. Write artifact: `.ai-agents/workspace/artifacts/{change-id}/analysis.md`
@@ -71,6 +71,7 @@ sections:
71
71
  - type: shared
72
72
  source: sections/session-update.md
73
73
  params:
74
+ current_skill: mvt-analyze
74
75
  update_active_change: true
75
76
 
76
77
  - type: shared
@@ -1,96 +1,110 @@
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
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
+ ## Operation Mode: Independent
75
+
76
+ This is an independent operation — no workflow prerequisites required.
77
+ - Does NOT create a change-id.
78
+ - Output is written to `.ai-agents/knowledge/project/_generated/project-context.md`.
79
+
80
+ - type: file
81
+ source: ./business.md
82
+
83
+ - type: inline
84
+ content: |
85
+ ## Artifact Structure
86
+ Read the document structure template from: `.ai-agents/skills/_templates/project-context.md`
87
+ If a custom version exists at `.ai-agents/skills/_templates/custom/project-context.md`, use the custom version instead.
88
+ The template defines section headings only. Generate content for each section based on code analysis results.
89
+ Write the artifact to: `.ai-agents/knowledge/project/_generated/project-context.md`
90
+
91
+ - type: shared
92
+ source: sections/session-update.md
93
+ params:
94
+ current_skill: mvt-analyze-code
95
+
96
+ - type: shared
97
+ source: sections/footer-next-steps.md
98
+ params:
99
+ current_skill: mvt-analyze-code
100
+ conditional_suggestions:
101
+ conditions:
102
+ - condition: "project-context.md generated, no active change"
103
+ primary: mvt-analyze
104
+ primary_desc: "Analyze requirements for a new feature"
105
+ - condition: "project-context.md generated, active change exists"
106
+ primary: mvt-design
107
+ primary_desc: "Design with the updated project context"
108
+ - condition: "analysis revealed outdated knowledge"
109
+ primary: mvt-manage-context
110
+ primary_desc: "Update knowledge entries"
@@ -0,0 +1,99 @@
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
+ ## Edge Cases & Errors
91
+
92
+ | Case | Handling |
93
+ |------|----------|
94
+ | Bug is intermittent / racy | Mark reproduction as "flaky", state confidence level explicitly, suggest adding instrumentation rather than speculative analysis |
95
+ | Root cause is in a third-party dependency | Document the upstream issue, note that local workaround would be the only fix option |
96
+ | Bug description describes expected behavior (NotABug) | Explain clearly with evidence from code/business rules, do NOT proceed to suggest fixes |
97
+ | Multiple independent bugs described in one input | Analyze each separately, present multiple diagnosis blocks |
98
+ | User provides a URL or external reference | Note it but do NOT fetch external resources; work only with local code and the description text |
99
+ | `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: inline
48
+ content: |
49
+ ## Operation Mode: Shortcut
50
+
51
+ This skill operates as a shortcut — it can execute at any time without checking workflow prerequisites.
52
+ - Do NOT update `active_change` fields (this is a shortcut operation, not a workflow phase).
53
+ - Do NOT write any artifact — diagnosis is presented in conversation only.
54
+ - Do NOT modify any source code — this skill is read-only analysis.
55
+
56
+ - type: file
57
+ source: ./business.md
58
+
59
+ - type: shared
60
+ source: sections/session-update.md
61
+ params:
62
+ current_skill: mvt-bug-detect
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"
@@ -13,7 +13,7 @@ This skill measures only files the **user** can reduce or relocate. Framework-fi
13
13
  - Semantic context: `.ai-agents/knowledge/project/_generated/project-context.md`.
14
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
15
  - Per-skill knowledge: every entry in `registry.yaml > skills.*.knowledge`, grouped by skill.
16
- - Artifacts: all files under `.ai-agents/workspace/artifacts/` recursively.
16
+ - Artifacts: all files under `.ai-agents/workspace/artifacts/` recursively. **Exclude the `_archived/` subdirectory** — it contains completed changes archived by `/mvt-cleanup` and should not count toward the active workspace token budget.
17
17
 
18
18
  **Out of scope (do NOT scan):**
19
19
  - `.claude/skills/mvt-*/SKILL.md` -- framework-shipped, not user-editable.
@@ -51,7 +51,7 @@ This skill measures only files the **user** can reduce or relocate. Framework-fi
51
51
  |---------|------------------|-----------------|
52
52
  | `project-context.md` is `oversized` | "project-context.md is {N} tokens. Regenerate with leaner sections." | `/mvt-analyze-code` |
53
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` |
54
+ | Total artifacts tokens > artifacts threshold OR > 3 completed changes still in `artifacts/` (excluding `_archived/`) | "Workspace has {N} tokens of historical artifacts. Archive completed changes." | `/mvt-cleanup` |
55
55
  | A specific change-id directory is `oversized` | "artifacts/{id} alone is {N} tokens. Summarize this change." | `/mvt-cleanup` |
56
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
57
  | A single Shared Knowledge file is `oversized` | "{path} is {N} tokens. Split or move to per-skill." | `/mvt-manage-context move` |
@@ -74,8 +74,6 @@ This skill measures only files the **user** can reduce or relocate. Framework-fi
74
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
75
  - The report is conversation output; this skill does NOT write any artifact.
76
76
 
77
- ### Step 7: (session update handled by shared section)
78
-
79
77
  ## Edge Cases & Errors
80
78
 
81
79
  | Case | Handling |
@@ -83,7 +81,7 @@ This skill measures only files the **user** can reduce or relocate. Framework-fi
83
81
  | `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
82
  | `core/manifest.yaml` cannot be parsed | Treat the whole `core/` tree as in-scope (over-counts); add a note in the report |
85
83
  | 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") |
84
+ | Workspace exceeds the artifacts threshold AND the user just ran `/mvt-cleanup` (within last hour per `history`) | Surface but downgrade to a one-line note ("recently cleaned -- remaining {N} tokens are likely active work") |
87
85
  | 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
86
  | 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
87
  | 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 |