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

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 (145) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +131 -147
  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 +18 -0
  24. package/dist/commands/migrate.d.ts.map +1 -0
  25. package/dist/commands/migrate.js +163 -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 +192 -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 +34 -26
  65. package/sources/skills/mvt-check-context/business.md +89 -42
  66. package/sources/skills/mvt-check-context/manifest.yaml +10 -21
  67. package/sources/skills/mvt-cleanup/business.md +80 -31
  68. package/sources/skills/mvt-cleanup/manifest.yaml +85 -93
  69. package/sources/skills/mvt-config/business.md +94 -26
  70. package/sources/skills/mvt-config/manifest.yaml +15 -27
  71. package/sources/skills/mvt-create-skill/business.md +224 -111
  72. package/sources/skills/mvt-create-skill/manifest.yaml +31 -15
  73. package/sources/skills/mvt-design/business.md +116 -34
  74. package/sources/skills/mvt-design/manifest.yaml +22 -31
  75. package/sources/skills/mvt-fix/business.md +103 -28
  76. package/sources/skills/mvt-fix/manifest.yaml +8 -22
  77. package/sources/skills/mvt-help/business.md +74 -70
  78. package/sources/skills/mvt-help/manifest.yaml +16 -10
  79. package/sources/skills/mvt-implement/business.md +91 -32
  80. package/sources/skills/mvt-implement/manifest.yaml +17 -33
  81. package/sources/skills/mvt-init/business.md +164 -49
  82. package/sources/skills/mvt-init/manifest.yaml +36 -28
  83. package/sources/skills/mvt-manage-context/business.md +175 -0
  84. package/sources/skills/mvt-manage-context/manifest.yaml +123 -0
  85. package/sources/skills/mvt-plan-dev/business.md +75 -0
  86. package/sources/skills/mvt-plan-dev/manifest.yaml +91 -0
  87. package/sources/skills/mvt-quick-dev/business.md +99 -0
  88. package/sources/skills/mvt-quick-dev/manifest.yaml +69 -0
  89. package/sources/skills/mvt-refactor/business.md +104 -33
  90. package/sources/skills/mvt-refactor/manifest.yaml +17 -32
  91. package/sources/skills/mvt-resume/business.md +137 -0
  92. package/sources/skills/mvt-resume/manifest.yaml +71 -0
  93. package/sources/skills/mvt-review/business.md +112 -49
  94. package/sources/skills/mvt-review/manifest.yaml +15 -34
  95. package/sources/skills/mvt-status/business.md +71 -24
  96. package/sources/skills/mvt-status/manifest.yaml +18 -26
  97. package/sources/skills/mvt-sync-context/business.md +148 -23
  98. package/sources/skills/mvt-sync-context/manifest.yaml +51 -39
  99. package/sources/skills/mvt-template/business.md +96 -49
  100. package/sources/skills/mvt-template/manifest.yaml +13 -21
  101. package/sources/skills/mvt-test/business.md +104 -36
  102. package/sources/skills/mvt-test/manifest.yaml +14 -23
  103. package/sources/skills/mvt-update-plan/business.md +72 -0
  104. package/sources/skills/mvt-update-plan/manifest.yaml +132 -0
  105. package/sources/templates/analyze-output/body.md +8 -31
  106. package/sources/templates/analyze-output/manifest.yaml +11 -11
  107. package/sources/templates/design-output/body.md +17 -50
  108. package/sources/templates/design-output/manifest.yaml +11 -11
  109. package/sources/templates/implement-output/body.md +6 -27
  110. package/sources/templates/implement-output/manifest.yaml +11 -11
  111. package/sources/templates/project-context/body.md +13 -0
  112. package/sources/templates/project-context/manifest.yaml +12 -0
  113. package/sources/templates/review-output/body.md +6 -40
  114. package/sources/templates/review-output/manifest.yaml +11 -11
  115. package/sources/templates/test-output/body.md +4 -28
  116. package/sources/templates/test-output/manifest.yaml +11 -11
  117. package/sources/knowledge/core/review-principles.md +0 -51
  118. package/sources/knowledge/patterns/clean-architecture/manifest.yaml +0 -66
  119. package/sources/knowledge/patterns/clean-architecture/review-checklist.md +0 -230
  120. package/sources/knowledge/patterns/ddd/manifest.yaml +0 -83
  121. package/sources/knowledge/patterns/ddd/review-checklist.md +0 -226
  122. package/sources/knowledge/patterns/ddd/tactical-patterns.md +0 -12
  123. package/sources/knowledge/patterns/frontend-react/manifest.yaml +0 -44
  124. package/sources/knowledge/patterns/frontend-react/review-checklist.md +0 -78
  125. package/sources/knowledge/patterns/manifest.yaml +0 -113
  126. package/sources/skills/mvt-add-context/business.md +0 -47
  127. package/sources/skills/mvt-add-context/manifest.yaml +0 -83
  128. package/sources/templates/analyze-code-output/body.md +0 -44
  129. package/sources/templates/analyze-code-output/manifest.yaml +0 -11
  130. package/sources/templates/cleanup-output/body.md +0 -9
  131. package/sources/templates/cleanup-output/manifest.yaml +0 -11
  132. package/sources/templates/config-output/body.md +0 -11
  133. package/sources/templates/config-output/manifest.yaml +0 -11
  134. package/sources/templates/context-check-output/body.md +0 -32
  135. package/sources/templates/context-check-output/manifest.yaml +0 -11
  136. package/sources/templates/fix-output/body.md +0 -30
  137. package/sources/templates/fix-output/manifest.yaml +0 -11
  138. package/sources/templates/init-output/body.md +0 -34
  139. package/sources/templates/init-output/manifest.yaml +0 -11
  140. package/sources/templates/refactor-output/body.md +0 -32
  141. package/sources/templates/refactor-output/manifest.yaml +0 -11
  142. package/sources/templates/status-output/body.md +0 -36
  143. package/sources/templates/status-output/manifest.yaml +0 -11
  144. package/sources/templates/sync-context-output/body.md +0 -16
  145. package/sources/templates/sync-context-output/manifest.yaml +0 -11
@@ -3,7 +3,7 @@ output: .claude/skills/mvt-review/SKILL.md
3
3
 
4
4
  frontmatter:
5
5
  name: mvt-review
6
- description: "Perform code review for quality, standards compliance, and best practices. Identifies issues by severity and suggests improvements. Use when user wants code reviewed or quality checked."
6
+ description: "Perform code review for quality, standards compliance, and best practices. This skill should be used when user wants code reviewed, quality checked, or to identify issues before merging."
7
7
 
8
8
  sections:
9
9
  - type: inline
@@ -12,7 +12,7 @@ sections:
12
12
 
13
13
  ## Purpose
14
14
 
15
- Review code for quality, standards compliance, and best practices. Identify issues by severity, suggest improvements, and ensure architecture compliance. This is the fourth phase in the full workflow: analyze -> design -> implement -> review -> test.
15
+ Review code for quality, standards compliance, and best practices. Identify issues by severity, suggest improvements, and ensure architecture compliance.
16
16
 
17
17
  - type: shared
18
18
  source: sections/role-header.md
@@ -21,7 +21,7 @@ sections:
21
21
  role_desc: "a Code Quality Guardian"
22
22
  decision_rules:
23
23
  - rule: "Critical issue found (security, data loss, crash) -> Mark as CRITICAL, require fix before merge"
24
- - rule: "Architecture violation found -> Flag for Architect, suggest `/mvt-design`"
24
+ - rule: "Layer violation found -> Flag for Architect, suggest `/mvt-design`"
25
25
  - rule: "Minor style issue -> Note as suggestion, don't block"
26
26
  - rule: "Subjective preference -> Mark as \"non-blocking\" optional improvement"
27
27
  - rule: "Good code pattern found -> Highlight positively"
@@ -41,7 +41,7 @@ sections:
41
41
 
42
42
  | Aspect | Focus Areas |
43
43
  |--------|-------------|
44
- | `architecture` | Pattern compliance, module boundaries, dependency direction |
44
+ | `architecture` | Layer compliance, module boundaries, dependency direction |
45
45
  | `security` | Input validation, injection prevention, authentication |
46
46
  | `performance` | N+1 queries, memory leaks, caching |
47
47
  | `style` | Naming conventions, formatting, documentation |
@@ -49,15 +49,10 @@ sections:
49
49
  Usage: `/mvt-review` or `/mvt-review --aspect {type}`
50
50
 
51
51
  - type: shared
52
- source: sections/activation-load-context.md
53
- params:
54
- extended_context:
55
- - ".ai-agents/knowledge/core/review-principles.md -- Universal review principles"
56
- - ".ai-agents/knowledge/principle/coding-standards.md -- Project coding standards"
57
- - ".ai-agents/knowledge/patterns/{pattern.active}/review-checklist.md -- Pattern-specific checklist"
52
+ source: sections/activation-load-config.md
58
53
 
59
54
  - type: shared
60
- source: sections/activation-load-config.md
55
+ source: sections/output-language-constraint.md
61
56
 
62
57
  - type: shared
63
58
  source: sections/activation-preflight.md
@@ -66,41 +61,27 @@ sections:
66
61
  - order: "1"
67
62
  field: "session.initialized_at"
68
63
  level: "WARN"
69
- message: 'Session not initialized. Run `/mvt-init` first.'
64
+ message: "Session not initialized. Run `/mvt-init` first."
70
65
  - order: "2"
71
66
  field: "no code to review"
72
67
  level: "WARN"
73
- message: 'No code to review. Run `/mvt-implement` first or specify files.'
74
- - order: "3"
75
- field: "pattern.active"
76
- level: "WARN"
77
- message: 'Architecture pattern not set. Suggest `/mvt-init`." (allow user to proceed)'
78
-
79
- - type: inline
80
- content: |
81
- ### Step 4: Execute
82
- Proceed to Execution Flow below.
68
+ message: "No code to review. Run `/mvt-implement` first or specify files."
83
69
 
84
70
  - type: file
85
71
  source: ./business.md
86
72
 
87
73
  - type: inline
88
74
  content: |
89
- ## Output Format
90
-
91
- Read and use the output template from: `.ai-agents/skills/_templates/review-output.md`
92
-
75
+ ## Artifact Structure
76
+ Read the document structure template from: `.ai-agents/skills/_templates/review-output.md`
93
77
  If a custom version exists at `.ai-agents/skills/_templates/custom/review-output.md`, use the custom version instead.
78
+ The template defines section headings only. Generate content for each section based on review results.
79
+ Write the artifact to: `.ai-agents/workspace/artifacts/{change-id}/review.md`
94
80
 
95
- Fill the template placeholders with the review results.
96
-
97
- Every response MUST end with a Suggested Next Steps section.
81
+ - type: shared
82
+ source: sections/session-update.md
98
83
 
99
84
  - type: shared
100
85
  source: sections/footer-next-steps.md
101
86
  params:
102
- next_primary: mvt-fix
103
- next_primary_desc: "Address critical issues"
104
- next_alternatives:
105
- - skill: mvt-test
106
- when: "Add missing tests"
87
+ current_skill: mvt-review
@@ -1,24 +1,71 @@
1
- ## Execution Flow
2
-
3
- ### Step 1: Load State
4
- - Read `session.yaml` for progress, active change, recent actions
5
- - Read `project-context.yaml` for project info, tech stack, architecture
6
-
7
- ### Step 2: Determine Current Phase
8
- - Check `progress` fields (analyze, design, implement, review, test)
9
- - Identify which phases are `done`, `pending`, or `in-progress`
10
- - Determine the current active phase
11
-
12
- ### Step 3: Build Workflow Visualization
13
- - Generate Mermaid flowchart showing phase progression
14
- - Color-code phases: green (done), yellow (current), gray (pending)
15
-
16
- ### Step 4: Compile Status Report
17
- - Project info summary
18
- - Progress table with phase status
19
- - Active change details (if any)
20
- - Recent actions history
21
-
22
- ### Step 5: Suggest Next Step
23
- - Based on current progress, recommend the logical next command
24
- - If all phases done -> Suggest `/mvt-cleanup` or starting a new feature
1
+ ## Execution Flow
2
+
3
+ ### Step 1: Load Inputs
4
+ - **Recommended**:
5
+ - `.ai-agents/knowledge/project/_generated/project-context.md` -- semantic context (only checked for existence here, not parsed).
6
+ - **Fallback / robustness**:
7
+ - If a YAML file is missing, mark its section as `(unavailable)` in the report and continue. Do not abort the whole skill.
8
+ - If a YAML file fails to parse, surface a one-line error with the file path and skip the affected section. Do not attempt automatic repair.
9
+ - If `session.yaml` exists but is empty (zero keys), treat as `not initialized` -> recommend `/mvt-init`.
10
+
11
+ ### Step 2: Build Activity Timeline
12
+ - **What**: produce the most-recent-first list of skill_history entries with derived metadata.
13
+ - **How**:
14
+ 1. Read `skill_history` from `session.yaml`.
15
+ 2. For each entry, attach: relative time (e.g., "2h ago"), `change_id` (if present), and the originating skill name.
16
+ 3. Limit to the last 10 entries for the rendered table; keep full count separately for the summary line.
17
+
18
+ ### Step 3: Discover All Plans (Multi-Change Dashboard)
19
+ - **What**: produce the canonical plan list across the workspace.
20
+ - **How**:
21
+ 1. Iterate `recent_changes[]` from `session.yaml`. For each entry with a `plan_path`, attempt to read the plan file.
22
+ 2. Glob `.ai-agents/workspace/artifacts/*/plan.yaml` to find any plans not registered in `recent_changes` (mark them `unindexed`).
23
+ 3. For each plan, extract: `change_id`, `title`, `status`, `current_task`, task progress (`done/total`), `updated_at`, `skill_hint` (from current task if present).
24
+ 4. If a plan file is present but malformed, include a row with `(corrupt)` in the status column and mark the file path; do not abort.
25
+ - **Branches**:
26
+
27
+ | Condition | Action |
28
+ |-----------|--------|
29
+ | No plans found anywhere | Skip the Changes Overview section entirely; render only legacy `active_change` summary |
30
+ | One plan found | Render Changes Overview with one row |
31
+ | Multiple plans found | Render Changes Overview sorted: `in_progress` desc by `updated_at` first, then `done` desc by `updated_at`, then `abandoned` last |
32
+ | Any plan over the cap (more than ~12 rows) | Show top 10 rows; print a `+N older changes hidden -- see artifacts/` line |
33
+
34
+ ### Step 4: Build the Status Report
35
+ - Render in this order, omitting any section whose inputs were unavailable:
36
+
37
+ 1. **Header** -- one-line summary: project name (from `project-context.yaml`), framework version, last synced timestamp.
38
+ 2. **Projects** -- table: name | type | tech stack (truncated). Cap at 10 rows; collapse the rest into `+N more`.
39
+ 3. **Semantic Context** -- one line: `project-context.md present` / `missing -- run /mvt-analyze-code`.
40
+ 4. **Active Change** -- if `active_change` exists: id, title, current phase, start time. Else: `none`.
41
+ 5. **Changes Overview** -- table from Step 3 (skip if no plans). Render with these columns:
42
+
43
+ | change-id | title | status | progress | current_task | last_updated |
44
+ |-----------|-------|--------|----------|--------------|--------------|
45
+ 6. **Skill History** -- last 5 rows of the timeline from Step 2.
46
+ 7. **Recent Actions** -- compact list (max 5).
47
+
48
+ - Hard cap: total rendered output should not exceed ~120 lines. If it would, truncate Skill History and Recent Actions first; never truncate the active change or Changes Overview header rows.
49
+
50
+ ### Step 5: Suggest Next Step
51
+ - Resolution order (first match wins):
52
+ 1. `active_change` has a plan in `in_progress`, `current_task` is set -> suggest the task's `skill_hint` (or, if missing, recommend `/mvt-update-plan` to set `current_task`).
53
+ 2. `active_change` exists but no plan -> infer next workflow phase from `skill_history` (last completed phase determines next).
54
+ 3. No `active_change`, but `project-context.md` is missing -> suggest `/mvt-analyze-code`.
55
+ 4. No `active_change`, no missing context -> suggest `/mvt-analyze` to start a new feature OR `/mvt-help` to browse the catalog.
56
+ - The suggestion must be a single line: skill command + one-clause reason.
57
+
58
+ ### Step 6: (session update handled by shared section)
59
+
60
+ ## Edge Cases & Errors
61
+
62
+ | Case | Handling |
63
+ |------|----------|
64
+ | `session.yaml` missing entirely | Render a minimal report (Projects section if available) and recommend `/mvt-init` |
65
+ | `session.yaml` corrupt (parse error) | Surface error with file path, render Projects only, recommend `/mvt-sync-context` |
66
+ | `recent_changes[]` references a `plan_path` that no longer exists | Include in Changes Overview with `(missing)` marker; do not delete the index entry from this skill |
67
+ | Plan file's `current_task` references a task id not in `tasks[]` | Render `current_task` as `(invalid: <id>)`; do not attempt to fix |
68
+ | Plan file's `status` is not one of the known values | Render the raw value verbatim; flag in skip-checks of the report |
69
+ | Both `recent_changes[]` and the artifact glob find the same plan | Deduplicate by `change_id`; prefer the indexed entry's metadata |
70
+ | Multiple `in_progress` plans | All rendered in Changes Overview; Step 5's suggestion picks the most recently updated; mention the count in the suggestion line |
71
+ | Workspace contains zero projects | Render header only with a single suggestion: `/mvt-init` |
@@ -3,7 +3,7 @@ output: .claude/skills/mvt-status/SKILL.md
3
3
 
4
4
  frontmatter:
5
5
  name: mvt-status
6
- description: "Show current project and workflow status including progress through phases, active changes, and session state. Use when user wants to check project status or see where they are in the workflow."
6
+ description: "Display current project and workflow status including skill history, active changes, and session state. This skill should be used when user wants to check project status, review workflow progress, or see where they are in the development cycle."
7
7
 
8
8
  sections:
9
9
  - type: inline
@@ -12,7 +12,7 @@ sections:
12
12
 
13
13
  ## Purpose
14
14
 
15
- Display comprehensive project and workflow status, showing progress through development phases, active changes, and current session state.
15
+ Display comprehensive project and workflow status, showing project list, semantic context availability, skill history, active changes, and current session state.
16
16
 
17
17
  - type: shared
18
18
  source: sections/role-header.md
@@ -22,7 +22,10 @@ sections:
22
22
  decision_rules:
23
23
  - rule: "If project not initialized -> Warn and suggest `/mvt-init`"
24
24
  - rule: "If no active change -> Show project info only, suggest starting a workflow"
25
- - rule: "If workflow in progress -> Highlight current phase and next recommended step"
25
+ - rule: "If workflow in progress -> Highlight recent skill history and next recommended step"
26
+ - rule: "If project-context.md missing -> Suggest `/mvt-analyze-code` to generate semantic context"
27
+ - rule: "If one or more plans exist -> Show Changes Overview table with progress for all plans"
28
+ - rule: "If an in_progress plan has a current_task -> Suggest the matching skill_hint as next step"
26
29
  boundaries:
27
30
  - scope: "analyze requirements"
28
31
  skill: "/mvt-analyze"
@@ -37,6 +40,9 @@ sections:
37
40
  - type: shared
38
41
  source: sections/activation-load-config.md
39
42
 
43
+ - type: shared
44
+ source: sections/output-language-constraint.md
45
+
40
46
  - type: shared
41
47
  source: sections/activation-preflight.md
42
48
  params:
@@ -44,31 +50,17 @@ sections:
44
50
  - order: "1"
45
51
  field: "session.initialized_at"
46
52
  level: "WARN"
47
- message: 'Session not initialized. Run `/mvt-init` first.'
48
- - order: "2"
49
- field: "project.name"
50
- level: "WARN"
51
- message: 'Project not initialized. Run `/mvt-init` first.'
52
-
53
- - type: inline
54
- content: |
55
- ### Step 4: Execute
56
- Proceed to Execution Flow below.
53
+ message: "Session not initialized. Run `/mvt-init` first."
57
54
 
58
55
  - type: file
59
56
  source: ./business.md
60
57
 
61
- - type: inline
62
- content: |
63
- ## Output Format
64
-
65
- Read and use the output template from: `.ai-agents/skills/_templates/status-output.md`
66
-
67
- If a custom version exists at `.ai-agents/skills/_templates/custom/status-output.md`, use the custom version instead.
68
-
69
- Fill the template placeholders with the current state data.
70
-
71
- Every response MUST end with a Suggested Next Steps section.
58
+ - type: shared
59
+ source: sections/session-update.md
60
+ params:
61
+ read_only: true
72
62
 
73
- ## Suggested Next Steps
74
- After completion, suggest the logical next workflow step based on current progress.
63
+ - type: shared
64
+ source: sections/footer-next-steps.md
65
+ params:
66
+ current_skill: mvt-status
@@ -1,25 +1,150 @@
1
1
  ## Execution Flow
2
2
 
3
- ### Step 1: Detect Changes
4
- - If git available:
5
- - Run `git diff --name-only` (unstaged changes)
6
- - Run `git diff --name-only --cached` (staged changes)
7
- - Run `git diff --name-only HEAD~1` (last commit changes)
8
- - Merge results and deduplicate
9
- - If git not available:
10
- - Scan for recently modified files in source directories
11
-
12
- ### Step 2: Analyze Changed Files
13
- - Read each changed file
14
- - Extract entities (classes, models, types)
15
- - Extract services (service classes, API handlers)
16
- - Extract keywords and topics
17
-
18
- ### Step 3: Update Workspace
19
- 1. Update `.ai-agents/workspace/project-context.yaml`:
20
- - Add new entities to architecture section
21
- - Add new services
22
- - Update module mappings
23
- 2. Update `.ai-agents/workspace/session.yaml`:
24
- - Set `session.last_command: "/mvt-sync-context"`
25
- - Append one-line summary to `recent_actions` (keep max 3)
3
+ ### Step 1: Identify Completed Changes
4
+ - **What**: produce a candidate list of change-ids whose artifacts will be aggregated.
5
+ - **How**:
6
+ 1. Read `session.yaml`. Collect `recent_changes[]` entries with `status: completed`.
7
+ 2. For each candidate, verify `.ai-agents/workspace/artifacts/{change-id}/` exists AND contains at least one of `analysis.md` or `design.md`. Drop entries with only `plan.yaml`.
8
+ 3. (Fallback) If `recent_changes[]` is empty, scan `.ai-agents/workspace/artifacts/*/` directly; offer those with `analysis.md` or `design.md`, marked `unindexed`.
9
+ 4. Exclude any change-id whose directory contains an `_archive/` subfolder (already archived).
10
+ 5. Exclude `active_change.id` (work in flight).
11
+
12
+ - **Present** the list:
13
+
14
+ | # | change-id | title | status | analysis.md | design.md | implementation.md |
15
+ |---|-----------|-------|--------|-------------|-----------|-------------------|
16
+
17
+ - **Always print before user confirmation**:
18
+ > Run `/mvt-sync-context` BEFORE `/mvt-cleanup`. Once cleanup archives a change-id, this skill will skip it.
19
+
20
+ - **Prompt**: "Select changes to aggregate. Indices (e.g. 1,3,5), `a` for all, `n` to cancel."
21
+
22
+ - Cancel / empty selection -> stop with "no changes applied".
23
+
24
+ ### Step 2: Read Current Project Context (Adaptive Structure Discovery)
25
+
26
+ This step establishes the **target structure** that aggregated content must fit into. The structure is NOT assumed -- it is derived from the current document.
27
+
28
+ 1. Read `.ai-agents/knowledge/project/_generated/project-context.md`.
29
+ - Already required by preflight; if discovered missing here, STOP and recommend `/mvt-analyze-code`.
30
+ 2. Parse the current `.md` into a section map:
31
+ - Each top-level `##` heading -> one section anchor.
32
+ - Record: section title (verbatim), byte range, and a 1-line semantic summary derived from the section's content (e.g., "lists domain terms with definitions" or "describes module dependencies").
33
+ - The summary is what enables matching in Step 3 -- section titles may be in any language and may not match conventional names (Terms / Modules / etc.).
34
+ 3. If the document has zero `##` sections (single block) -> STOP. Recommend `/mvt-analyze-code` to establish a sectioned baseline first.
35
+ 4. Read `.ai-agents/workspace/project-context.yaml`. Record current `projects[].source_paths`, `modules`, and `tech_stack` for diff comparison in Step 4d.
36
+
37
+ ### Step 3: Extract and Classify Artifact Content
38
+
39
+ - **What**: from each selected change-id, extract atomic knowledge items and classify them against the section map from Step 2.
40
+ - **How**:
41
+ 1. For each selected change-id, read available artifacts (`analysis.md`, `design.md`, `implementation.md`).
42
+ 2. Extract atomic items. Typical sources:
43
+ - `analysis.md` -> domain terms, actors, business rules, constraints
44
+ - `design.md` -> modules, layers, dependency rules, key interfaces, ADRs
45
+ - `implementation.md` -> files added/changed (informs `.yaml` source_paths), realized vs deviated design points
46
+ 3. For each item, match to a section from the Step 2 map:
47
+ - Match by semantic similarity to **section title + 1-line summary**, not by exact string.
48
+ - Confidence levels:
49
+ - **mapped**: exactly one section matches with high confidence
50
+ - **ambiguous**: 2+ sections plausibly match
51
+ - **orphan**: no section matches; propose a new section name
52
+ 4. For each item, also detect change type relative to current section content:
53
+ - `new` -- target section does not contain this entity
54
+ - `modify` -- target section mentions the entity but artifact provides a different value
55
+ - `redundant` -- already present, no change (will be filtered out, not shown to user)
56
+
57
+ ### Step 4: Render the Update Plan (Four Tables)
58
+
59
+ #### 4a. Section-mapped items
60
+ | # | change-id | item | type | target section | classification |
61
+ |---|-----------|------|------|----------------|----------------|
62
+
63
+ #### 4b. Conflicts requiring resolution (every `modify` item)
64
+ | # | item | section | current value | proposed value (from {change-id}) |
65
+ |---|------|---------|---------------|-----------------------------------|
66
+
67
+ #### 4c. Ambiguous and orphan items
68
+ | # | item | reason | candidate sections (or proposed new section) |
69
+ |---|------|--------|----------------------------------------------|
70
+
71
+ #### 4d. Implied yaml changes
72
+ | # | yaml field | current | proposed |
73
+ |---|------------|---------|----------|
74
+
75
+ ### Step 5: User Confirmation (Per-Table)
76
+
77
+ - **4a**: default = accept all. User input: indices to drop, or `e <n>` to edit a single item's target section.
78
+ - **4b**: **explicit per-row decision required**. Format `<index>:<keep|replace|edit>`. Example: `1:replace,2:keep,3:edit`. No default.
79
+ - **4c**: per row, user picks an existing section, types a new section name, or `skip`.
80
+ - **4d**: default = accept; user can drop indices.
81
+
82
+ Then ask: **"Run optional read-only code verification before applying? (y/n)"**
83
+
84
+ ### Step 6: (Optional) Read-only Code Verification
85
+
86
+ This step catches artifacts claiming entities never actually delivered. It is **read-only** -- it never writes anything to `.md` or `.yaml`.
87
+
88
+ If user opts in:
89
+ 1. For each accepted item naming a code entity (module path, file, class, function), search the codebase under registered `source_paths`:
90
+ - Module path -> directory exists?
91
+ - File -> file exists?
92
+ - Symbol -> grep within source_paths
93
+ 2. Classify findings:
94
+
95
+ | Finding | Action |
96
+ |---------|--------|
97
+ | Artifact item matches code | Mark `verified`; keep in apply list |
98
+ | Artifact item NOT found in code | Flag `unverified`; ask user: drop or proceed (likely reverted / un-merged) |
99
+ | Code contains module / file / symbol that NO artifact item references | **Do NOT add to apply list.** Print: `Code-only entity detected: {path}. Run /mvt-analyze-code for ground-truth rebuild.` |
100
+
101
+ 3. Re-render the apply list with `verified` / `unverified` markers; final confirmation.
102
+
103
+ If user skips verification: proceed directly to Step 7 with Step 5 selections.
104
+
105
+ ### Step 7: Apply Updates (Merge Mode)
106
+
107
+ - **Pre-write**:
108
+ 1. Backup: `project-context.md` -> `project-context.md.bak`; `project-context.yaml` -> `project-context.yaml.bak`. Overwrite any prior `.bak`.
109
+ 2. Backup write failure -> STOP, do not modify originals.
110
+
111
+ - **Update `project-context.md`** (merge, never rewrite):
112
+ 1. Each `new` item: append to target section, matching the section's existing style (bullet vs paragraph).
113
+ 2. Each `modify` item with `replace`: replace the matching line in place. Smallest possible diff.
114
+ 3. Each `orphan` item with new-section choice: append a new `##` section at end of file.
115
+ 4. **Never delete** any existing line. **Never reorder** existing sections.
116
+
117
+ - **Update `project-context.yaml`** (structured merge):
118
+ 1. Apply accepted entries from Table 4d.
119
+ 2. Add new `source_paths` to matching project entry; add new modules to `modules[]`.
120
+ 3. **Never delete** an existing yaml entry in this skill.
121
+
122
+ - **Atomicity**: temp + rename per file. If `.md` write succeeds but `.yaml` fails (or vice versa) -> restore the failed one from `.bak`, keep the other; report partial success.
123
+
124
+ ### Step 8: Report
125
+
126
+ 1. **Applied summary** -- counts: items added / modified / skipped / orphaned-into-new-section
127
+ 2. **Files changed** -- paths + byte deltas
128
+ 3. **Backup paths** -- so user can manually revert
129
+ 4. **Out-of-scope reminder** (always print):
130
+ > This skill processes additions and modifications only. Module deletions, renames, and large refactors are NOT detected here. Run `/mvt-analyze-code` periodically to rebuild from ground truth.
131
+ 5. **Suggested next**:
132
+ - Aggregated >= 1 change -> "Run `/mvt-cleanup` to archive these completed changes."
133
+ - Verification flagged code-only entities -> "Run `/mvt-analyze-code` to capture missing entities."
134
+
135
+ ### Step 9: (session update handled by shared section)
136
+ - Refresh `session.last_synced_at` to current ISO timestamp.
137
+
138
+ ## Edge Cases & Errors
139
+
140
+ | Case | Handling |
141
+ |------|----------|
142
+ | `project-context.md` does not exist | Caught at preflight; recommend `/mvt-analyze-code` |
143
+ | `.md` has zero `##` sections | STOP at Step 2; recommend `/mvt-analyze-code` |
144
+ | Selected change-id has only `plan.yaml` | Filtered in Step 1; will not appear |
145
+ | `modify` with `replace` but the existing line cannot be located deterministically | Fall back to append + flag as duplicate-needs-manual-edit; do NOT silently overwrite the wrong line |
146
+ | `.md.bak` already exists | Overwrite (only the most recent backup matters) |
147
+ | User aborts at Step 5 | Do not write; report "no changes applied" |
148
+ | Step 6 verification finds zero matches for everything | Strong warning; require explicit confirm before proceeding (artifacts likely describe planned, not delivered, work) |
149
+ | Two artifacts contradict each other (design says layer A, implementation says layer B) | Surface in Table 4b as cross-artifact conflict; user picks |
150
+ | change-id was archived between Step 1 and Step 7 | Skip with note; do not error the run |
@@ -3,7 +3,7 @@ output: .claude/skills/mvt-sync-context/SKILL.md
3
3
 
4
4
  frontmatter:
5
5
  name: mvt-sync-context
6
- description: "Synchronize workspace context with code changes after manual modifications or git operations. Use when context seems out of sync with code, after manual edits, or after git merge/rebase."
6
+ description: "Aggregate completed change artifacts (analysis/design/implementation) and merge new domain knowledge into project-context.md and project-context.yaml. This skill should be used after one or more changes are completed to keep long-term project knowledge in sync with delivered work."
7
7
 
8
8
  sections:
9
9
  - type: inline
@@ -12,7 +12,7 @@ sections:
12
12
 
13
13
  ## Purpose
14
14
 
15
- Synchronize the MVTT workspace context with code changes made outside the workflow. This is a code-driven, automatic synchronization that scans git diffs and file changes to update project context.
15
+ Keep `project-context.md` (semantic) and `project-context.yaml` (structural index) in sync with completed work. This is an artifact-driven, incremental synchronization: it reads workspace artifacts of completed changes, classifies new domain knowledge, and merges it into the long-term context. It does NOT scan code for new content; an optional read-only code verification step can validate that artifact-claimed entities exist.
16
16
 
17
17
  - type: shared
18
18
  source: sections/role-header.md
@@ -20,65 +20,77 @@ sections:
20
20
  role: Conductor
21
21
  role_desc: "a Workflow Coordinator"
22
22
  decision_rules:
23
- - rule: "Git available -> Use git diff to detect changes"
24
- - rule: "Git not available -> Scan for recently modified files"
25
- - rule: "Changes detected -> Analyze and update context"
26
- - rule: "No changes detected -> Report context is already in sync"
23
+ - rule: "Completed changes found -> List for user confirmation, then aggregate"
24
+ - rule: "No completed changes since last sync -> Report nothing to do"
25
+ - rule: "Conflicts with existing project-context.md -> Render conflict table, require user resolution"
26
+ - rule: "User opts in to code verification -> Run read-only scan; flag artifact entries that cannot be located"
27
+ - rule: "Code-only entities discovered (in code, not in artifacts) -> Do NOT write; recommend /mvt-analyze-code"
28
+ - rule: "Artifact references modules/source_paths absent from project-context.yaml -> Propose yaml additions for user confirmation"
27
29
  boundaries:
28
- - scope: "analyze requirements"
29
- skill: "/mvt-analyze"
30
- - scope: "design architecture"
31
- skill: "/mvt-design"
32
- - scope: "write implementation code"
33
- skill: "/mvt-implement"
30
+ - scope: "regenerate project-context.md from full code scan"
31
+ skill: "/mvt-analyze-code"
32
+ - scope: "archive completed change artifacts"
33
+ skill: "/mvt-cleanup"
34
+ - scope: "manage shared / per-skill knowledge files"
35
+ skill: "/mvt-manage-context"
34
36
 
35
37
  - type: inline
36
38
  content: |
37
39
  ### When to Use
38
- - After manual code changes outside the workflow
39
- - When context seems out of sync with code
40
- - After git operations (merge, rebase, etc.)
40
+ - After one or more changes are marked `completed` and you want to fold their knowledge into long-term context
41
+ - BEFORE running `/mvt-cleanup` (sync first, archive after)
42
+ - When `project-context.md` looks behind delivered work but you do not want to pay a full `/mvt-analyze-code` regeneration
43
+
44
+ ### When NOT to Use
45
+ - For deletions, renames, or module deprecations -> use `/mvt-analyze-code` (full ground-truth rebuild)
46
+ - To pick up code changes never recorded as MVTT changes -> use `/mvt-analyze-code`
47
+ - To clean / archive workspace -> use `/mvt-cleanup`
41
48
 
42
49
  - type: shared
43
50
  source: sections/activation-load-context.md
51
+ params:
52
+ extended_context:
53
+ - ".ai-agents/workspace/artifacts/{change-id}/ -- Source artifacts for completed changes"
54
+ - ".ai-agents/knowledge/project/_generated/project-context.md -- Current semantic context (merge target)"
55
+ - ".ai-agents/workspace/project-context.yaml -- Current structural index (merge target)"
44
56
 
45
57
  - type: shared
46
58
  source: sections/activation-load-config.md
47
59
 
60
+ - type: shared
61
+ source: sections/output-language-constraint.md
62
+
48
63
  - type: shared
49
64
  source: sections/activation-preflight.md
50
65
  params:
51
66
  checks:
52
67
  - order: "1"
53
- field: "project-context is empty"
54
- level: "WARN"
55
- message: 'Project not initialized. Run `/mvt-init` first.'
56
-
57
- - type: inline
58
- content: |
59
- ### Step 4: Execute
60
- Proceed to Execution Flow below.
68
+ field: "session.initialized_at"
69
+ level: "BLOCK"
70
+ message: "Session not initialized. Run `/mvt-init` first."
71
+ - order: "2"
72
+ field: ".ai-agents/knowledge/project/_generated/project-context.md exists"
73
+ level: "BLOCK"
74
+ message: "project-context.md not found. Run `/mvt-analyze-code` to create the initial document; this skill only handles incremental updates."
61
75
 
62
76
  - type: file
63
77
  source: ./business.md
64
78
 
65
- - type: inline
66
- content: |
67
- ## Output Format
68
-
69
- Read and use the output template from: `.ai-agents/skills/_templates/sync-context-output.md`
70
-
71
- If a custom version exists at `.ai-agents/skills/_templates/custom/sync-context-output.md`, use the custom version instead.
72
-
73
- Fill the template placeholders with the sync results.
74
-
75
- Every response MUST end with a Suggested Next Steps section.
79
+ - type: shared
80
+ source: sections/session-update.md
76
81
 
77
82
  - type: shared
78
83
  source: sections/footer-next-steps.md
79
84
  params:
80
- next_primary: mvt-status
81
- next_primary_desc: "Verify context state after sync"
82
- next_alternatives:
83
- - skill: "(continue)"
84
- when: "Continue with your current task"
85
+ current_skill: mvt-sync-context
86
+ conditional_suggestions:
87
+ conditions:
88
+ - condition: "merge applied successfully"
89
+ primary: "mvt-cleanup"
90
+ primary_desc: "Archive aggregated change artifacts now that knowledge is sync'd"
91
+ - condition: "code verification flagged code-only entities"
92
+ primary: "mvt-analyze-code"
93
+ primary_desc: "Regenerate project-context.md from full code scan"
94
+ - condition: "default"
95
+ primary: "mvt-check-context"
96
+ primary_desc: "Audit token cost and overall context health"