@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,74 +1,63 @@
1
- name: mvt-check-context
2
- output: .claude/skills/mvt-check-context/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-check-context
6
- description: "Analyze context token load and give optimization recommendations. Use when user wants to check how much context MVTT loads, identify large files, or optimize workspace size for better performance."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Context Check
12
-
13
- ## Purpose
14
-
15
- Analyze the total context information that MVTT loads at runtime, estimate token consumption, assess health status, and provide actionable optimization recommendations.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Conductor
21
- role_desc: "a Workflow Coordinator"
22
- decision_rules:
23
- - rule: "Total tokens < 5,000 -> Report as \"Good\""
24
- - rule: "Total tokens 5,000-15,000 -> Report as \"Moderate\""
25
- - rule: "Total tokens 15,000-30,000 -> Report as \"High\", suggest optimizations"
26
- - rule: "Total tokens > 30,000 -> Report as \"Overloaded\", strongly recommend cleanup"
27
- boundaries:
28
- - scope: "modify any files"
29
- skill: "(Only analyze and recommend)"
30
- - scope: "clean up artifacts"
31
- skill: "/mvt-cleanup"
32
- - scope: "modify context"
33
- skill: "/mvt-add-context"
34
-
35
- - type: shared
36
- source: sections/activation-load-context.md
37
- params:
38
- extended_context:
39
- - ".ai-agents/config.yaml -- Framework configuration (to be scanned for size)"
40
-
41
- - type: shared
42
- source: sections/activation-load-config.md
43
-
44
- - type: inline
45
- content: |
46
- ### Step 3: Pre-flight Checks
47
- - No blocking checks required.
48
-
49
- ### Step 4: Execute
50
- Proceed to Execution Flow below.
51
-
52
- - type: file
53
- source: ./business.md
54
-
55
- - type: inline
56
- content: |
57
- ## Output Format
58
-
59
- Read and use the output template from: `.ai-agents/skills/_templates/context-check-output.md`
60
-
61
- If a custom version exists at `.ai-agents/skills/_templates/custom/context-check-output.md`, use the custom version instead.
62
-
63
- Fill the template with analysis results.
64
-
65
- Every response MUST end with a Suggested Next Steps section.
66
-
67
- - type: shared
68
- source: sections/footer-next-steps.md
69
- params:
70
- next_primary: mvt-cleanup
71
- next_primary_desc: "Clean up old artifacts to reduce context size"
72
- next_alternatives:
73
- - skill: mvt-add-context
74
- when: "Update project context if information is outdated"
1
+ name: mvt-check-context
2
+ output: .claude/skills/mvt-check-context/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-check-context
6
+ description: "Analyze context token load and provide optimization recommendations. This skill should be used when user wants to check how much context MVTT loads, identify large files, or optimize workspace size for better performance."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Context Check
12
+
13
+ ## Purpose
14
+
15
+ Analyze the total context information that MVTT loads at runtime, estimate token consumption, assess health status, and provide actionable optimization recommendations.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Conductor
21
+ role_desc: "a Workflow Coordinator"
22
+ decision_rules:
23
+ - rule: "Total tokens < 5,000 -> Report as \"Good\""
24
+ - rule: "Total tokens 5,000-15,000 -> Report as \"Moderate\""
25
+ - rule: "Total tokens 15,000-30,000 -> Report as \"High\", suggest optimizations"
26
+ - rule: "Total tokens > 30,000 -> Report as \"Overloaded\", strongly recommend cleanup"
27
+ boundaries:
28
+ - scope: "modify any files"
29
+ skill: "(Only analyze and recommend)"
30
+ - scope: "clean up artifacts"
31
+ skill: "/mvt-cleanup"
32
+ - scope: "modify context"
33
+ skill: "/mvt-manage-context"
34
+
35
+ - type: shared
36
+ source: sections/activation-load-context.md
37
+ params:
38
+ extended_context:
39
+ - ".ai-agents/config.yaml -- Framework configuration (to be scanned for size)"
40
+
41
+ - type: shared
42
+ source: sections/activation-load-config.md
43
+
44
+ - type: shared
45
+ source: sections/output-language-constraint.md
46
+
47
+ - type: inline
48
+ content: |
49
+ ### Step 3: Pre-flight Checks
50
+ - No blocking checks required.
51
+
52
+ - type: file
53
+ source: ./business.md
54
+
55
+ - type: shared
56
+ source: sections/session-update.md
57
+ params:
58
+ read_only: true
59
+
60
+ - type: shared
61
+ source: sections/footer-next-steps.md
62
+ params:
63
+ current_skill: mvt-check-context
@@ -1,31 +1,80 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Scan Workspace State
4
- - Read all files under `.ai-agents/workspace/artifacts/{change-id}/`
5
- - Read `.ai-agents/workspace/session.yaml`
6
- - Count total artifact files
7
- - Estimate token footprint for each file (~characters / 4)
8
-
9
- ### Step 2: Identify Cleanup Candidates
10
- - Apply cleanup rules to identify candidates
11
- - Calculate current size and projected savings for each
12
-
13
- ### Step 3: Present Cleanup Plan
14
- Show user what will be cleaned:
15
-
16
- | Item | Current Size | Action | Result |
17
- |------|-------------|--------|--------|
18
- | {artifact} | ~{tokens} tokens | {action} | ~{reduced} tokens |
19
- | **Total** | **{total}** | | **{new_total} ({savings} saved)** |
20
-
21
- If `--dry-run` flag is set -> Stop here. Do not proceed.
22
-
23
- ### Step 4: Execute (after user confirmation)
24
- - Summarize identified artifacts (keep key decisions, remove details)
25
- - Update `session.yaml` to reflect cleanup
26
- - Output summary of actions taken
27
-
28
- ### Step 5: Update Workspace
29
- 1. Update `.ai-agents/workspace/session.yaml`:
30
- - Set `session.last_command: "/mvt-cleanup"`
31
- - Append one-line summary to `recent_actions` (keep max 3)
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Fallback**: if `session.yaml` is missing, refuse to clean -- without state we can't tell what is in-progress vs completed; recommend `/mvt-init` and stop.
5
+
6
+ ### Step 2: Inventory Artifacts
7
+ - **What**: produce a per-change-id inventory with size and last-modified data.
8
+ - **How**:
9
+ 1. Walk `.ai-agents/workspace/artifacts/` and group files by their parent change-id directory.
10
+ 2. For each file: characters, estimated tokens (`chars / 4`), last-modified (mtime).
11
+ 3. For each change-id directory, sum tokens and file count.
12
+ 4. Mark each change-id as `active | in-recent-changes | unindexed | legacy-pattern`:
13
+ - `active` if it matches `session.active_change.id`.
14
+ - `in-recent-changes` if it appears in `session.recent_changes[]` (any status).
15
+ - `unindexed` if neither condition holds and it sits under `artifacts/`.
16
+ - `legacy-pattern` if the directory is `knowledge/patterns/` or matches other legacy markers.
17
+
18
+ ### Step 3: Apply Cleanup Rules
19
+ - **What**: compute Cleanup Candidates from the inventory.
20
+ - **How**: run the rules table (defined in the shared section above) plus the additions below. A single change-id may match multiple rows; collect all proposed actions.
21
+
22
+ | Source | Rule | Proposed action |
23
+ |--------|------|-----------------|
24
+ | `recent_changes[]` entry with `status: completed` AND any task in plan is older than the active change's start | Summarize: collapse multi-file artifacts into a single `summary.md`, keep the plan.yaml verbatim, archive the rest under `artifacts/{id}/_archive/` |
25
+ | Change-id directory marked `unindexed` | List for user review (do NOT auto-archive -- could be in-flight work the user just hasn't registered) |
26
+ | `skill_history` entries beyond the most recent 10 | Collapse into a single summary entry inside session.yaml (rule from Cleanup Rules table) |
27
+ | Directory `knowledge/patterns/` exists | Flag for deletion (legacy pattern data; no replacement) |
28
+ | Empty change-id directories (zero files inside) | Propose deletion of the directory itself |
29
+
30
+ - For each candidate, compute: `current size (tokens)` -> `projected size (tokens)`, expected savings.
31
+
32
+ ### Step 4: Present Cleanup Plan
33
+ - Render the plan as a table:
34
+
35
+ | Item | Category | Current Size | Action | Result |
36
+ |------|----------|-------------|--------|--------|
37
+ | {change-id or path} | {completed | unindexed | stale-history | legacy} | ~{tokens} | {summarize | archive | review-only | delete} | ~{reduced tokens} |
38
+ | **Total** | | **{total}** | | **{new_total} ({savings} saved)** |
39
+
40
+ - Below the table, list any items marked `review-only` (unindexed) with a one-line note: user must decide manually.
41
+ - If `--dry-run` is set, STOP here. Print "(dry run -- no changes applied)" and exit cleanly.
42
+
43
+ ### Step 5: Confirm Before Destructive Steps
44
+ - **Always require confirmation** if the plan includes any of:
45
+ - File deletion (legacy patterns, empty dirs).
46
+ - `summarize` action (collapses multi-file content).
47
+ - `archive` action (moves files into `_archive/`).
48
+ - Confirmation format: a single prompt `Apply cleanup plan? (y / n / show-details)`. `show-details` prints the per-file actions, then re-asks.
49
+ - Do NOT silently delete. Do NOT skip confirmation when `--dry-run` is absent.
50
+
51
+ ### Step 6: Execute the Plan
52
+ - **What**: apply the confirmed actions.
53
+ - **How**:
54
+ 1. **Summarize action**: read the full set of files in the change-id directory; produce a `summary.md` with: title, change-id, status, key decisions (list each ADR/decision title), final outcomes, list of original files. Then move originals to `_archive/`.
55
+ 2. **Archive action**: move files into `_archive/` under the same change-id directory, preserving relative paths.
56
+ 3. **Delete action**: remove only the items explicitly marked for deletion in the confirmed plan; never recurse beyond what was listed.
57
+ 4. **Stale skill_history collapse**: rewrite `session.yaml`'s `skill_history` keeping the most recent 10 detailed entries plus one rolled-up entry summarizing the older ones (count + earliest/latest date).
58
+ 5. All file mutations atomic where possible (write-temp + rename, copy-then-delete for moves).
59
+ 6. If any single action fails, STOP further actions; report what completed, what failed, and leave a recoverable state (do not partially overwrite a file with truncated content).
60
+
61
+ ### Step 7: Report Result
62
+ - Print the actually-applied actions (may differ from the plan if Step 6 stopped early).
63
+ - Show new totals: files cleaned, tokens saved.
64
+ - Recommend `/mvt-check-context` to validate the post-cleanup state if savings exceed ~5k tokens.
65
+
66
+ ### Step 8: (session update handled by shared section)
67
+ - This skill mutates `session.skill_history` directly in Step 6 (collapse). The standard `skill_history` append from the shared section still applies; the collapse runs BEFORE the append so the new entry is preserved at full detail.
68
+
69
+ ## Edge Cases & Errors
70
+
71
+ | Case | Handling |
72
+ |------|----------|
73
+ | `active_change.id` directory matches a "stale completed" rule | Skip cleanup of the active change; never archive in-progress work |
74
+ | `--dry-run` set | Stop after Step 4; do not request confirmation; do not modify any file |
75
+ | Plan would archive ALL artifacts (workspace becomes empty) | Require an extra confirmation: `This will archive every artifact. Continue? (y/n)` |
76
+ | User aborts at Step 5 confirmation | Report "no changes applied" |
77
+ | `_archive/` already exists with content from a prior run | Preserve existing `_archive/` content; new archives are added alongside |
78
+ | File targeted for action no longer exists (concurrent removal) | Skip with a note; do not error out the whole run |
79
+ | Unindexed change-id directory contains only `plan.yaml` | List as review-only; suggest user runs `/mvt-update-plan` or registers it via `/mvt-plan-dev` instead of cleaning |
80
+ | `session.yaml.bak` present from a previous failed run | Overwrite during Step 6 collapse (only the most recent backup is useful) |
@@ -1,93 +1,85 @@
1
- name: mvt-cleanup
2
- output: .claude/skills/mvt-cleanup/SKILL.md
3
-
4
- frontmatter:
5
- name: mvt-cleanup
6
- description: "Clean up workspace artifacts, summarize old changes, and maintain workspace health. Use when workspace has accumulated old artifacts or to reduce context token footprint."
7
-
8
- sections:
9
- - type: inline
10
- content: |
11
- # MVT Cleanup
12
-
13
- ## Purpose
14
-
15
- Clean up workspace artifacts, summarize completed changes, and maintain workspace health. Reduces token footprint by archiving old artifacts and removing stale data.
16
-
17
- - type: shared
18
- source: sections/role-header.md
19
- params:
20
- role: Conductor
21
- role_desc: "a Workflow Coordinator"
22
- decision_rules:
23
- - rule: "No arguments -> Interactive cleanup (review items before action)"
24
- - rule: "`--dry-run` flag -> Show what would be cleaned without taking action"
25
- - rule: "Completed changes found -> Summarize and archive"
26
- - rule: "Orphaned artifacts found -> List for user review"
27
- - rule: "Stale session data found -> Summarize into single entry"
28
- boundaries:
29
- - scope: "analyze requirements"
30
- skill: "/mvt-analyze"
31
- - scope: "design architecture"
32
- skill: "/mvt-design"
33
- - scope: "write implementation code"
34
- skill: "/mvt-implement"
35
-
36
- - type: inline
37
- content: |
38
- ## Variants
39
-
40
- | Variant | Description |
41
- |---------|-------------|
42
- | `/mvt-cleanup` | Interactive cleanup (review before action) |
43
- | `/mvt-cleanup --dry-run` | Preview what would be cleaned |
44
-
45
- - type: shared
46
- source: sections/activation-load-context.md
47
- params:
48
- extended_context:
49
- - "Scan all files under `.ai-agents/workspace/artifacts/` (all change-id directories)"
50
-
51
- - type: shared
52
- source: sections/activation-load-config.md
53
-
54
- - type: shared
55
- source: sections/activation-preflight.md
56
- params:
57
- checks:
58
- - order: "1"
59
- field: "project not initialized"
60
- level: "REQUIRED"
61
- message: "Project must be initialized (session.yaml exists)"
62
-
63
- - type: inline
64
- content: |
65
- ### Step 4: Execute
66
- Proceed to Execution Flow below.
67
-
68
- ## Cleanup Rules
69
-
70
- | Category | Rule | Action |
71
- |----------|------|--------|
72
- | Completed changes | Change with `status: completed` older than current task | Summarize -> archive |
73
- | Orphaned artifacts | Files in `artifacts/` not referenced by any active change | List for user review |
74
- | Stale session data | Session history entries older than 5 phases ago | Summarize into single entry |
75
-
76
- - type: file
77
- source: ./business.md
78
-
79
- - type: inline
80
- content: |
81
- ## Output Format
82
-
83
- Read and use the output template from: `.ai-agents/skills/_templates/cleanup-output.md`
84
-
85
- If a custom version exists at `.ai-agents/skills/_templates/custom/cleanup-output.md`, use the custom version instead.
86
-
87
- Every response MUST end with a Suggested Next Steps section.
88
-
89
- - type: shared
90
- source: sections/footer-next-steps.md
91
- params:
92
- next_primary: mvt-status
93
- next_primary_desc: "Verify workspace state"
1
+ name: mvt-cleanup
2
+ output: .claude/skills/mvt-cleanup/SKILL.md
3
+
4
+ frontmatter:
5
+ name: mvt-cleanup
6
+ description: "Clean up workspace artifacts, summarize completed changes, and maintain workspace health. This skill should be used when workspace has accumulated old artifacts, token footprint needs reduction, or to archive completed change records."
7
+
8
+ sections:
9
+ - type: inline
10
+ content: |
11
+ # MVT Cleanup
12
+
13
+ ## Purpose
14
+
15
+ Clean up workspace artifacts, summarize completed changes, and maintain workspace health. Reduces token footprint by archiving old artifacts and removing stale data.
16
+
17
+ - type: shared
18
+ source: sections/role-header.md
19
+ params:
20
+ role: Conductor
21
+ role_desc: "a Workflow Coordinator"
22
+ decision_rules:
23
+ - rule: "No arguments -> Interactive cleanup (review items before action)"
24
+ - rule: "`--dry-run` flag -> Show what would be cleaned without taking action"
25
+ - rule: "Completed changes found -> Summarize and archive"
26
+ - rule: "Orphaned artifacts found -> List for user review"
27
+ - rule: "Stale session data found -> Summarize into single entry"
28
+ boundaries:
29
+ - scope: "analyze requirements"
30
+ skill: "/mvt-analyze"
31
+ - scope: "design architecture"
32
+ skill: "/mvt-design"
33
+ - scope: "write implementation code"
34
+ skill: "/mvt-implement"
35
+
36
+ - type: inline
37
+ content: |
38
+ ## Variants
39
+
40
+ | Variant | Description |
41
+ |---------|-------------|
42
+ | `/mvt-cleanup` | Interactive cleanup (review before action) |
43
+ | `/mvt-cleanup --dry-run` | Preview what would be cleaned |
44
+
45
+ - type: shared
46
+ source: sections/activation-load-context.md
47
+ params:
48
+ extended_context:
49
+ - "Scan all files under `.ai-agents/workspace/artifacts/` (all change-id directories)"
50
+
51
+ - type: shared
52
+ source: sections/activation-load-config.md
53
+
54
+ - type: shared
55
+ source: sections/output-language-constraint.md
56
+
57
+ - type: shared
58
+ source: sections/activation-preflight.md
59
+ params:
60
+ checks:
61
+ - order: "1"
62
+ field: "project not initialized"
63
+ level: "REQUIRED"
64
+ message: "Project must be initialized (session.yaml exists)"
65
+
66
+ - type: inline
67
+ content: |
68
+ ## Cleanup Rules
69
+
70
+ | Category | Rule | Action |
71
+ |----------|------|--------|
72
+ | Completed changes | Change with `status: completed` older than current task | Summarize -> archive |
73
+ | Orphaned artifacts | Files in `artifacts/` not referenced by any active change | List for user review |
74
+ | Stale session data | Session history entries older than 5 phases ago | Summarize into single entry |
75
+
76
+ - type: file
77
+ source: ./business.md
78
+
79
+ - type: shared
80
+ source: sections/session-update.md
81
+
82
+ - type: shared
83
+ source: sections/footer-next-steps.md
84
+ params:
85
+ current_skill: mvt-cleanup
@@ -1,26 +1,94 @@
1
- ## Execution Flow
2
-
3
- ### Interactive Menu (Default)
4
- 1. Read current settings from `config.yaml`
5
- 2. Display configuration menu with categories and current values
6
- 3. Wait for user to select a category (1-5)
7
- 4. Show category detail view with editable settings
8
- 5. Apply changes after user confirmation
9
-
10
- ### Direct Set (`set {key} {value}`)
11
- 1. Validate key exists -- if not, show available keys
12
- 2. Validate value type -- if wrong, show expected type
13
- 3. Preview the change (old -> new)
14
- 4. Ask user to confirm
15
- 5. Apply and write `config.yaml`
16
-
17
- ### Guided Wizard (`wizard`)
18
- 1. Step 1: Language Preference
19
- 2. Step 2: Output Style (emojis, data format)
20
- 3. Step 3: Architecture Pattern
21
- 4. Summary Preview -> User confirms -> Apply all changes
22
-
23
- ### Reset (`reset`)
24
- 1. Show all settings that will be reset
25
- 2. Ask user confirmation
26
- 3. Write default values to `config.yaml`
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Recommended**:
5
+ - `.ai-agents/knowledge/core/manifest.yaml` -- only when computing token estimates for shared knowledge view.
6
+ - **Fallback**: if `config.yaml` is missing, surface the error and recommend `mvtt install` or `/mvt-init`. Do not silently create a fresh config from this skill.
7
+
8
+ ### Step 2: Dispatch by Mode
9
+ - **What**: pick the operating mode from the user's invocation.
10
+ - **How**:
11
+
12
+ | Invocation | Mode | Go to |
13
+ |------------|------|-------|
14
+ | `/mvt-config` (no args) | Interactive Menu | Step 3 |
15
+ | `/mvt-config show` | Show All | Step 4 |
16
+ | `/mvt-config set {key} {value}` | Direct Set | Step 5 |
17
+ | `/mvt-config wizard` | Guided Wizard | Step 6 |
18
+ | `/mvt-config reset` | Reset | Step 7 |
19
+ | Anything else | Refuse, print Variants table, stop | -- |
20
+
21
+ ### Step 3: Interactive Menu
22
+ 1. Read current `config.yaml` and render a numbered menu grouped by category (User Preferences, Knowledge Settings, etc.) with current values inline.
23
+ 2. Wait for user to select a category number (or `q` to quit).
24
+ 3. Show the category detail view: keys with current values, type, default, allowed values.
25
+ 4. Let user pick a key to edit; reuse Step 5 (Direct Set) sub-flow for validation, preview, confirmation, write.
26
+ 5. After write, return to the top-level menu until user quits.
27
+ 6. No write happens unless the Step 5 sub-flow confirms.
28
+
29
+ ### Step 4: Show All
30
+ - Print every key with `current value | type | default`. Mark values that differ from default with a `*`.
31
+ - Print the Configuration Keys reference table (provided in shared section above) below the values, for context.
32
+ - No write.
33
+
34
+ ### Step 5: Direct Set (`set {key} {value}`)
35
+ 1. **Validate key exists**:
36
+ - The key must match one of the rows in the Configuration Keys table. If not, print "Unknown key: <name>", list available keys, exit without writing.
37
+ 2. **Validate value type and constraints**:
38
+
39
+ | Type | Validation |
40
+ |------|------------|
41
+ | `enum` | Value MUST be in the allowed list. Reject with the allowed list shown. For `language` enums (`en-US`, `zh-CN`), reject other locale strings -- ask user to pick from the allowed list (do not fuzzy-match) |
42
+ | `bool` | Accept exactly `true` / `false` (case-insensitive). Reject `yes`/`1`/`y` |
43
+ | `int` | Parse as integer; check range when range is documented (e.g., `relevance_threshold` must be 0-100) |
44
+ | `list` | Parse as comma-separated tokens; for `knowledge.shared`, every token must be a registered knowledge id |
45
+
46
+ 3. **Preview**: render `key: <current> -> <new>` on a single line.
47
+ 4. **Confirm**: prompt `Apply this change? (y/n)`. Skip the prompt only if invocation included an explicit non-interactive flag (none currently exists, so always prompt).
48
+ 5. **Write atomically**:
49
+ - Read the current file, mutate only the targeted key, preserve all other content and formatting (do NOT rewrite the whole file from a template -- the user may have comments).
50
+ - Write to a temp file in the same directory, then rename. On any error, do not touch the original.
51
+ 6. Report the new value and a one-line "what this affects" hint (e.g., "applies to subsequent skill invocations").
52
+
53
+ ### Step 6: Guided Wizard
54
+ - Walk the user through these stages in order. Each stage uses the Step 5 validation rules. Defer the actual write to the end.
55
+
56
+ | Stage | Key | Notes |
57
+ |-------|-----|-------|
58
+ | 1 | `preferences.interaction_language` | Default `en-US`. Show allowed list |
59
+ | 2 | `preferences.document_output_language` | Default = whatever was just set in stage 1; user may override. Reuse stage-1 value when user accepts default |
60
+ | 3 | `preferences.output.no_emojis` | Default `true` |
61
+ | 4 | `preferences.output.data_format` | Default `yaml`; allowed: `yaml`, `json` |
62
+ | 5 | `preferences.context_routing.relevance_threshold` | Default `70`; allowed: 0-100 |
63
+
64
+ - After all stages, render a Summary Preview table: `key | from | to`, then a single confirmation prompt to apply ALL changes atomically.
65
+ - If the user aborts at the summary, discard all in-progress values; do not write anything.
66
+
67
+ ### Step 7: Reset
68
+ 1. Build the diff between current `config.yaml` and framework defaults: list every key that will revert.
69
+ 2. Render the diff as `key | current | will-become-default`.
70
+ 3. Require explicit confirmation: `Reset all settings to defaults? (y/n)`.
71
+ 4. Backup current `config.yaml` to `config.yaml.bak` before writing.
72
+ 5. Write defaults atomically.
73
+ 6. Report the keys that changed.
74
+ - Do NOT reset `knowledge.shared` to defaults if the user has added entries via `/mvt-manage-context` -- preserve user-added knowledge ids; only reset preferences. Surface this exception in the diff.
75
+
76
+ ### Step 8: (session update handled by shared section)
77
+
78
+ ## Knowledge Inspection (sub-flow used by Interactive Menu and Show All)
79
+ - **View**: list shared knowledge ids from `registry.yaml > knowledge.shared`, then per-skill knowledge ids grouped by skill (`registry.yaml > skills.*.knowledge`). Show token estimates from each entry's manifest if available.
80
+ - **Modify**: this skill does NOT mutate knowledge settings; defer to `/mvt-manage-context`. Print the suggested command (`/mvt-manage-context move`, `/mvt-manage-context add`, etc.) instead of doing the work here.
81
+
82
+ ## Edge Cases & Errors
83
+
84
+ | Case | Handling |
85
+ |------|----------|
86
+ | `config.yaml` missing | STOP; recommend `mvtt install` or `/mvt-init` |
87
+ | `config.yaml` exists but unparseable YAML | Surface error with line number; refuse to write; recommend manual fix or `mvtt install --refresh` |
88
+ | User runs `set` with a deprecated key (`preferences.language`) | Print migration hint: `Run mvtt update --migrate-config` to split into the two language fields. Do not mutate the deprecated key |
89
+ | Wizard stage receives an empty value | Treat as "accept default for this stage", continue |
90
+ | User aborts mid-wizard | No partial write; the temp values are discarded |
91
+ | `.bak` from previous reset already exists | Overwrite (only the most recent backup is useful) |
92
+ | Concurrent edit detected (mtime changed during preview->write) | Abort write, surface a message, ask user to re-run |
93
+ | `set knowledge.shared <list>` includes unknown id | Reject with the list of valid ids from `registry.yaml` |
94
+ | `reset` invoked but `config.yaml` already matches defaults | Report "nothing to reset", do not write |