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

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 (80) hide show
  1. package/README.md +1 -11
  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 +12 -4
  7. package/dist/fs/materialize.js.map +1 -1
  8. package/dist/fs/registry-merge.d.ts +19 -0
  9. package/dist/fs/registry-merge.d.ts.map +1 -0
  10. package/dist/fs/registry-merge.js +177 -0
  11. package/dist/fs/registry-merge.js.map +1 -0
  12. package/dist/scripts/plan-update.cjs +7563 -0
  13. package/dist/scripts/session-update.cjs +7568 -0
  14. package/install-manifest.yaml +8 -2
  15. package/package.json +3 -2
  16. package/sources/defaults/config.yaml +7 -7
  17. package/sources/defaults/session.yaml +9 -16
  18. package/sources/scripts/plan-update.js +353 -0
  19. package/sources/scripts/session-update.js +351 -0
  20. package/sources/sections/activation-load-context.md +4 -0
  21. package/sources/sections/footer-next-steps.md +1 -1
  22. package/sources/sections/output-format-constraint.md +14 -0
  23. package/sources/sections/project-context-profile.md +29 -0
  24. package/sources/sections/session-update.md +100 -32
  25. package/sources/skills/mvt-analyze/manifest.yaml +4 -0
  26. package/sources/skills/mvt-analyze-code/manifest.yaml +24 -4
  27. package/sources/skills/mvt-bug-detect/business.md +99 -101
  28. package/sources/skills/mvt-bug-detect/manifest.yaml +84 -84
  29. package/sources/skills/mvt-check-context/business.md +3 -5
  30. package/sources/skills/mvt-check-context/manifest.yaml +15 -8
  31. package/sources/skills/mvt-cleanup/business.md +49 -23
  32. package/sources/skills/mvt-cleanup/manifest.yaml +18 -10
  33. package/sources/skills/mvt-config/business.md +1 -2
  34. package/sources/skills/mvt-config/manifest.yaml +11 -4
  35. package/sources/skills/mvt-create-skill/business.md +6 -5
  36. package/sources/skills/mvt-create-skill/manifest.yaml +30 -11
  37. package/sources/skills/mvt-design/business.md +3 -6
  38. package/sources/skills/mvt-design/manifest.yaml +17 -1
  39. package/sources/skills/mvt-fix/business.md +2 -1
  40. package/sources/skills/mvt-fix/manifest.yaml +9 -3
  41. package/sources/skills/mvt-help/business.md +2 -4
  42. package/sources/skills/mvt-help/manifest.yaml +13 -5
  43. package/sources/skills/mvt-implement/business.md +10 -7
  44. package/sources/skills/mvt-implement/manifest.yaml +16 -0
  45. package/sources/skills/mvt-init/business.md +2 -2
  46. package/sources/skills/mvt-init/manifest.yaml +4 -0
  47. package/sources/skills/mvt-manage-context/business.md +11 -0
  48. package/sources/skills/mvt-manage-context/manifest.yaml +20 -3
  49. package/sources/skills/mvt-plan-dev/business.md +101 -20
  50. package/sources/skills/mvt-plan-dev/manifest.yaml +21 -19
  51. package/sources/skills/mvt-quick-dev/business.md +2 -1
  52. package/sources/skills/mvt-quick-dev/manifest.yaml +24 -6
  53. package/sources/skills/mvt-refactor/business.md +2 -1
  54. package/sources/skills/mvt-refactor/manifest.yaml +24 -3
  55. package/sources/skills/mvt-resume/business.md +28 -68
  56. package/sources/skills/mvt-resume/manifest.yaml +17 -7
  57. package/sources/skills/mvt-review/business.md +3 -3
  58. package/sources/skills/mvt-review/manifest.yaml +25 -1
  59. package/sources/skills/mvt-status/business.md +14 -18
  60. package/sources/skills/mvt-status/manifest.yaml +11 -3
  61. package/sources/skills/mvt-sync-context/business.md +69 -35
  62. package/sources/skills/mvt-sync-context/manifest.yaml +9 -0
  63. package/sources/skills/mvt-template/business.md +0 -2
  64. package/sources/skills/mvt-template/manifest.yaml +13 -8
  65. package/sources/skills/mvt-test/business.md +3 -3
  66. package/sources/skills/mvt-test/manifest.yaml +17 -1
  67. package/sources/skills/mvt-update-plan/business.md +41 -28
  68. package/sources/skills/mvt-update-plan/manifest.yaml +14 -19
  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 -16
  78. package/dist/commands/migrate.d.ts.map +0 -1
  79. package/dist/commands/migrate.js +0 -118
  80. package/dist/commands/migrate.js.map +0 -1
@@ -9,24 +9,24 @@
9
9
  - If `session.yaml` exists but is empty (zero keys), treat as `not initialized` -> recommend `/mvt-init`.
10
10
 
11
11
  ### Step 2: Build Activity Timeline
12
- - **What**: produce the most-recent-first list of skill_history entries with derived metadata.
12
+ - **What**: produce the most-recent-first list of history entries with derived metadata.
13
13
  - **How**:
14
- 1. Read `skill_history` from `session.yaml`.
14
+ 1. Read `history` from `session.yaml`.
15
15
  2. For each entry, attach: relative time (e.g., "2h ago"), `change_id` (if present), and the originating skill name.
16
16
  3. Limit to the last 10 entries for the rendered table; keep full count separately for the summary line.
17
17
 
18
18
  ### Step 3: Discover All Plans (Multi-Change Dashboard)
19
19
  - **What**: produce the canonical plan list across the workspace.
20
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`).
21
+ 1. Iterate `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 `changes` (mark them `unindexed`). **Exclude paths under `artifacts/_archived/`** — those are completed changes archived by `/mvt-cleanup`.
23
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
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
25
  - **Branches**:
26
26
 
27
27
  | Condition | Action |
28
28
  |-----------|--------|
29
- | No plans found anywhere | Skip the Changes Overview section entirely; render only legacy `active_change` summary |
29
+ | No plans found anywhere | Skip the Changes Overview section entirely; render "No active changes." |
30
30
  | One plan found | Render Changes Overview with one row |
31
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
32
  | Any plan over the cap (more than ~12 rows) | Show top 10 rows; print a `+N older changes hidden -- see artifacts/` line |
@@ -37,35 +37,31 @@
37
37
  1. **Header** -- one-line summary: project name (from `project-context.yaml`), framework version, last synced timestamp.
38
38
  2. **Projects** -- table: name | type | tech stack (truncated). Cap at 10 rows; collapse the rest into `+N more`.
39
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`.
40
+ 4. **Active Change** -- if `active_change` exists: id, title, start time. Else: `none`.
41
41
  5. **Changes Overview** -- table from Step 3 (skip if no plans). Render with these columns:
42
42
 
43
- | change-id | title | status | progress | current_task | last_updated |
44
- |-----------|-------|--------|----------|--------------|--------------|
43
+ | change-id | title | status | progress | current_task | updated_at |
44
+ |-----------|-------|--------|----------|--------------|------------|
45
45
  6. **Skill History** -- last 5 rows of the timeline from Step 2.
46
- 7. **Recent Actions** -- compact list (max 5).
47
46
 
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.
47
+ - Hard cap: total rendered output should not exceed ~120 lines. If it would, truncate Skill History first; never truncate the active change or Changes Overview header rows.
49
48
 
50
49
  ### Step 5: Suggest Next Step
51
50
  - Resolution order (first match wins):
52
51
  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.
52
+ 2. `project-context.md` is missing -> suggest `/mvt-analyze-code`.
53
+ 3. No `active_change` or no active plan -> suggest `/mvt-analyze` to start a new feature OR `/mvt-help` to browse the catalog.
56
54
  - The suggestion must be a single line: skill command + one-clause reason.
57
55
 
58
- ### Step 6: (session update handled by shared section)
59
-
60
56
  ## Edge Cases & Errors
61
57
 
62
58
  | Case | Handling |
63
59
  |------|----------|
64
60
  | `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 |
61
+ | `session.yaml` corrupt (parse error) | Surface error with file path, render Projects only, recommend `/mvt-init` to reinitialize |
62
+ | `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
63
  | Plan file's `current_task` references a task id not in `tasks[]` | Render `current_task` as `(invalid: <id>)`; do not attempt to fix |
68
64
  | 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 |
65
+ | Both `changes[]` and the artifact glob find the same plan | Deduplicate by `change_id`; prefer the indexed entry's metadata |
70
66
  | 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
67
  | Workspace contains zero projects | Render header only with a single suggestion: `/mvt-init` |
@@ -40,9 +40,6 @@ sections:
40
40
  - type: shared
41
41
  source: sections/activation-load-config.md
42
42
 
43
- - type: shared
44
- source: sections/output-language-constraint.md
45
-
46
43
  - type: shared
47
44
  source: sections/activation-preflight.md
48
45
  params:
@@ -64,3 +61,14 @@ sections:
64
61
  source: sections/footer-next-steps.md
65
62
  params:
66
63
  current_skill: mvt-status
64
+ conditional_suggestions:
65
+ conditions:
66
+ - condition: "active change with current_task"
67
+ primary: mvt-resume
68
+ primary_desc: "Resume work on the current task"
69
+ - condition: "project-context.md missing"
70
+ primary: mvt-analyze-code
71
+ primary_desc: "Generate semantic project context"
72
+ - condition: "no active change"
73
+ primary: mvt-analyze
74
+ primary_desc: "Start analyzing a new feature"
@@ -3,10 +3,12 @@
3
3
  ### Step 1: Identify Completed Changes
4
4
  - **What**: produce a candidate list of change-ids whose artifacts will be aggregated.
5
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).
6
+ 1. Read `session.yaml`. Collect `changes[]` entries with `status: done`.
7
+ 2. For each candidate, verify `.ai-agents/workspace/artifacts/{change-id}/` exists AND contains at least one of `analysis.md` or `implementation.md`. Drop entries with only `plan.yaml`, or with only `design.md` (design artifacts are not aggregated -- see Step 3).
8
+ 3. (Fallback) If `changes[]` is empty, scan `.ai-agents/workspace/artifacts/*/` directly; offer those with `analysis.md` or `implementation.md`, marked `unindexed`.
9
+ 4. Exclude already-archived or irrelevant changes:
10
+ - **Indexed changes**: exclude any `changes[]` entry with `status: abandoned`. For `status: done` entries, Step 1.2's directory existence check already filters out those whose artifacts have been moved to `artifacts/_archived/` by `/mvt-cleanup`.
11
+ - **Fallback scan**: when scanning `artifacts/*/` directly, skip any path under `artifacts/_archived/` (the unified archive directory managed by `/mvt-cleanup`).
10
12
  5. Exclude `active_change.id` (work in flight).
11
13
 
12
14
  - **Present** the list:
@@ -30,58 +32,85 @@ This step establishes the **target structure** that aggregated content must fit
30
32
  2. Parse the current `.md` into a section map:
31
33
  - Each top-level `##` heading -> one section anchor.
32
34
  - 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.).
35
+ - The summary is what enables matching in Step 5 -- section titles may be in any language and may not match conventional names (Terms / Modules / etc.).
34
36
  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.
37
+ 4. Read `.ai-agents/workspace/project-context.yaml`. Record current `projects[].source_paths`, `modules`, and `tech_stack` for diff comparison in Step 5d.
36
38
 
37
- ### Step 3: Extract and Classify Artifact Content
39
+ ### Step 3: Extract Artifact Content
38
40
 
39
- - **What**: from each selected change-id, extract atomic knowledge items and classify them against the section map from Step 2.
41
+ - **What**: from each selected change-id, extract atomic knowledge items (do not classify yet).
40
42
  - **How**:
41
- 1. For each selected change-id, read available artifacts (`analysis.md`, `design.md`, `implementation.md`).
43
+ 1. For each selected change-id, read available artifacts (`analysis.md`, `implementation.md`). Do NOT read `design.md` -- design artifacts are not aggregated by this skill.
42
44
  2. Extract atomic items. Typical sources:
43
45
  - `analysis.md` -> domain terms, actors, business rules, constraints
44
- - `design.md` -> modules, layers, dependency rules, key interfaces, ADRs
45
46
  - `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
+
48
+ ### Step 4: Normalize Extracted Content
49
+
50
+ Before classifying extracted items against the section map, normalize each item per the **Document Profile: project-context.md** section loaded above. This step strips intra-artifact cross-references -- meaningful in their source document but noise in project-context.md -- before they enter the merge pipeline.
51
+
52
+ 1. For each extracted item, apply the normalization rules below (the governing principle lives in the Document Profile; this table lists concrete patterns, non-exhaustive):
53
+
54
+ | Pattern | Example | Normalization |
55
+ |---------|---------|---------------|
56
+ | ADR reference with section number | `(ADR-06, §12.4)` | Remove the reference; keep the substantive content it annotates |
57
+ | Bare ADR reference | `per ADR-06`, `(ADR-06)` | Remove entirely |
58
+ | Section number reference | `§12.4`, `§3.2.1` | Remove entirely |
59
+ | Design rule label prefix | `B-1:`, `D-7:`, `C-3:` | Remove the prefix; keep the rule text |
60
+ | Parenthesized design label | `(D-7)`, `(B-4)` | Remove entirely |
61
+ | Cross-artifact link phrase | `see §X`, `refer to ADR-N` | Remove the link phrase |
62
+ | Other reference pointing outside project-context.md | Any pattern not listed above | Apply the governing principle: if understanding requires an external document, strip the reference marker |
63
+
64
+ **Critical**: strip only the *reference marker*, never the *substantive content* it annotates.
65
+
66
+ 2. After normalization, re-evaluate each item:
67
+ - Still contains substantive content -> keep for classification in Step 5.
68
+ - Was entirely a cross-reference with no independent semantic value -> drop it (it is a pointer, not knowledge).
69
+ 3. Any normalization that removes content from a `modify` item (where the item modifies an existing entry) must be flagged in the update plan (Step 6, Table 6b) so the user can verify the substantive meaning was preserved.
70
+
71
+ ### Step 5: Classify Artifact Content
72
+
73
+ - **What**: classify each normalized item against the section map from Step 2.
74
+ - **How**:
75
+ 1. For each item, match to a section from the Step 2 map:
47
76
  - Match by semantic similarity to **section title + 1-line summary**, not by exact string.
48
77
  - Confidence levels:
49
78
  - **mapped**: exactly one section matches with high confidence
50
79
  - **ambiguous**: 2+ sections plausibly match
51
80
  - **orphan**: no section matches; propose a new section name
52
- 4. For each item, also detect change type relative to current section content:
81
+ 2. For each item, also detect change type relative to current section content:
53
82
  - `new` -- target section does not contain this entity
54
83
  - `modify` -- target section mentions the entity but artifact provides a different value
55
84
  - `redundant` -- already present, no change (will be filtered out, not shown to user)
56
85
 
57
- ### Step 4: Render the Update Plan (Four Tables)
86
+ ### Step 6: Render the Update Plan (Four Tables)
58
87
 
59
- #### 4a. Section-mapped items
88
+ #### 6a. Section-mapped items
60
89
  | # | change-id | item | type | target section | classification |
61
90
  |---|-----------|------|------|----------------|----------------|
62
91
 
63
- #### 4b. Conflicts requiring resolution (every `modify` item)
92
+ #### 6b. Conflicts requiring resolution (every `modify` item)
64
93
  | # | item | section | current value | proposed value (from {change-id}) |
65
94
  |---|------|---------|---------------|-----------------------------------|
66
95
 
67
- #### 4c. Ambiguous and orphan items
96
+ #### 6c. Ambiguous and orphan items
68
97
  | # | item | reason | candidate sections (or proposed new section) |
69
98
  |---|------|--------|----------------------------------------------|
70
99
 
71
- #### 4d. Implied yaml changes
100
+ #### 6d. Implied yaml changes
72
101
  | # | yaml field | current | proposed |
73
102
  |---|------------|---------|----------|
74
103
 
75
- ### Step 5: User Confirmation (Per-Table)
104
+ ### Step 7: User Confirmation (Per-Table)
76
105
 
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.
106
+ - **6a**: default = accept all. User input: indices to drop, or `e <n>` to edit a single item's target section.
107
+ - **6b**: **explicit per-row decision required**. Format `<index>:<keep|replace|edit>`. Example: `1:replace,2:keep,3:edit`. No default.
108
+ - **6c**: per row, user picks an existing section, types a new section name, or `skip`.
109
+ - **6d**: default = accept; user can drop indices.
81
110
 
82
111
  Then ask: **"Run optional read-only code verification before applying? (y/n)"**
83
112
 
84
- ### Step 6: (Optional) Read-only Code Verification
113
+ ### Step 8: (Optional) Read-only Code Verification
85
114
 
86
115
  This step catches artifacts claiming entities never actually delivered. It is **read-only** -- it never writes anything to `.md` or `.yaml`.
87
116
 
@@ -100,9 +129,9 @@ If user opts in:
100
129
 
101
130
  3. Re-render the apply list with `verified` / `unverified` markers; final confirmation.
102
131
 
103
- If user skips verification: proceed directly to Step 7 with Step 5 selections.
132
+ If user skips verification: proceed directly to Step 9 with Step 7 selections.
104
133
 
105
- ### Step 7: Apply Updates (Merge Mode)
134
+ ### Step 9: Apply Updates (Merge Mode)
106
135
 
107
136
  - **Pre-write**:
108
137
  1. Backup: `project-context.md` -> `project-context.md.bak`; `project-context.yaml` -> `project-context.yaml.bak`. Overwrite any prior `.bak`.
@@ -113,27 +142,32 @@ If user skips verification: proceed directly to Step 7 with Step 5 selections.
113
142
  2. Each `modify` item with `replace`: replace the matching line in place. Smallest possible diff.
114
143
  3. Each `orphan` item with new-section choice: append a new `##` section at end of file.
115
144
  4. **Never delete** any existing line. **Never reorder** existing sections.
145
+ 5. All merged content must already be normalized per Step 4 rules. Do not re-introduce stripped references during inline replacement or append operations.
116
146
 
117
147
  - **Update `project-context.yaml`** (structured merge):
118
- 1. Apply accepted entries from Table 4d.
148
+ 1. Apply accepted entries from Table 6d.
119
149
  2. Add new `source_paths` to matching project entry; add new modules to `modules[]`.
120
150
  3. **Never delete** an existing yaml entry in this skill.
121
151
 
122
152
  - **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
153
 
124
- ### Step 8: Report
154
+ ### Step 10: Report
125
155
 
126
156
  1. **Applied summary** -- counts: items added / modified / skipped / orphaned-into-new-section
127
157
  2. **Files changed** -- paths + byte deltas
128
158
  3. **Backup paths** -- so user can manually revert
129
- 4. **Out-of-scope reminder** (always print):
159
+ 4. **Synced changes** -- list all change-ids whose knowledge was aggregated in this run:
160
+ > The following changes have been synced and can be safely archived: {change-id-1}, {change-id-2}, ...
161
+ > Last synced at: {last_synced_at} (updated by this run)
162
+ 5. **Out-of-scope reminder** (always print):
130
163
  > 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**:
164
+ 6. **Suggested next**:
132
165
  - Aggregated >= 1 change -> "Run `/mvt-cleanup` to archive these completed changes."
133
166
  - Verification flagged code-only entities -> "Run `/mvt-analyze-code` to capture missing entities."
134
167
 
135
- ### Step 9: (session update handled by shared section)
136
- - Refresh `session.last_synced_at` to current ISO timestamp.
168
+ ### Step 11: State Update
169
+ Apply the State Update rules defined in the **State Update** section below.
170
+ - The `--set-synced` parameter updates `session.last_synced_at`.
137
171
 
138
172
  ## Edge Cases & Errors
139
173
 
@@ -144,7 +178,7 @@ If user skips verification: proceed directly to Step 7 with Step 5 selections.
144
178
  | Selected change-id has only `plan.yaml` | Filtered in Step 1; will not appear |
145
179
  | `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
180
  | `.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 |
181
+ | User aborts at Step 7 | Do not write; report "no changes applied" |
182
+ | Step 8 verification finds zero matches for everything | Strong warning; require explicit confirm before proceeding (artifacts likely describe planned, not delivered, work) |
183
+ | Two artifacts contradict each other (analysis claims rule X, implementation realizes rule Y) | Surface in Table 6b as cross-artifact conflict; user picks |
184
+ | change-id was archived between Step 1 and Step 9 | Skip with note; do not error the run |
@@ -60,6 +60,9 @@ sections:
60
60
  - type: shared
61
61
  source: sections/output-language-constraint.md
62
62
 
63
+ - type: shared
64
+ source: sections/output-format-constraint.md
65
+
63
66
  - type: shared
64
67
  source: sections/activation-preflight.md
65
68
  params:
@@ -73,11 +76,17 @@ sections:
73
76
  level: "BLOCK"
74
77
  message: "project-context.md not found. Run `/mvt-analyze-code` to create the initial document; this skill only handles incremental updates."
75
78
 
79
+ - type: shared
80
+ source: sections/project-context-profile.md
81
+
76
82
  - type: file
77
83
  source: ./business.md
78
84
 
79
85
  - type: shared
80
86
  source: sections/session-update.md
87
+ params:
88
+ current_skill: mvt-sync-context
89
+ set_synced: true
81
90
 
82
91
  - type: shared
83
92
  source: sections/footer-next-steps.md
@@ -82,8 +82,6 @@
82
82
 
83
83
  3. Never write outside the project root unless an absolute path was explicitly provided by the user.
84
84
 
85
- ### Step 5: (session update handled by shared section)
86
-
87
85
  ## Edge Cases & Errors
88
86
 
89
87
  | Case | Handling |
@@ -27,10 +27,10 @@ sections:
27
27
  - rule: "User selects \"export\" -> Output template to specified location"
28
28
  - rule: "Custom template must preserve frontmatter format"
29
29
  boundaries:
30
- - scope: "modify default templates in `_templates/` root"
31
- skill: "(Only create/modify in `custom/`)"
32
- - scope: "modify skill logic"
33
- skill: "(Only change output formatting)"
30
+ - scope: "modify default templates in `_templates/` root (only create/modify in `custom/`)"
31
+ skill: "(constraint)"
32
+ - scope: "modify skill logic (only change output formatting)"
33
+ skill: "(constraint)"
34
34
 
35
35
  - type: shared
36
36
  source: sections/activation-load-context.md
@@ -41,12 +41,9 @@ sections:
41
41
  - type: shared
42
42
  source: sections/activation-load-config.md
43
43
 
44
- - type: shared
45
- source: sections/output-language-constraint.md
46
-
47
44
  - type: inline
48
45
  content: |
49
- ### Step 3: Pre-flight Checks
46
+ ### Step 4: Pre-flight Checks
50
47
  - No blocking checks required.
51
48
 
52
49
  - type: file
@@ -61,3 +58,11 @@ sections:
61
58
  source: sections/footer-next-steps.md
62
59
  params:
63
60
  current_skill: mvt-template
61
+ conditional_suggestions:
62
+ conditions:
63
+ - condition: "template customized"
64
+ primary: mvt-status
65
+ primary_desc: "Check project status"
66
+ - condition: "template reset to default"
67
+ primary: mvt-help
68
+ primary_desc: "Review available skills and templates"
@@ -76,8 +76,7 @@
76
76
  - Record each finding with: scenario id, expected vs observed, severity (Critical / Warning), and recommend `/mvt-fix`.
77
77
 
78
78
  ### Step 9: Write Artifact
79
- - **Path**: `.ai-agents/workspace/artifacts/{active_change.id}/tests/test-design.md`.
80
- - **Template**: `.ai-agents/skills/_templates/test-output.md` (custom override at `_templates/custom/...` takes precedence).
79
+ - **Path and template**: as defined in the **Artifact Structure** section below.
81
80
  - **Required content** (mapped to template headings):
82
81
  - `Scope` -- target files, fallbacks applied.
83
82
  - `Test Framework & Layout` -- chosen framework, file layout convention.
@@ -89,7 +88,8 @@
89
88
  - `Suggested Run Commands` -- one or two commands the user can copy-paste.
90
89
  - The actual test files go to the project tree; the artifact is a record.
91
90
 
92
- ### Step 10: (session update handled by shared section)
91
+ ### Step 10: State Update
92
+ Apply the State Update rules defined in the **State Update** section below.
93
93
 
94
94
  ## Edge Cases & Errors
95
95
 
@@ -57,6 +57,9 @@ sections:
57
57
  - type: shared
58
58
  source: sections/output-language-constraint.md
59
59
 
60
+ - type: shared
61
+ source: sections/output-format-constraint.md
62
+
60
63
  - type: shared
61
64
  source: sections/activation-preflight.md
62
65
  params:
@@ -66,7 +69,7 @@ sections:
66
69
  level: "WARN"
67
70
  message: "Session not initialized. Run `/mvt-init` first."
68
71
  - order: "2"
69
- field: "no implementation files"
72
+ field: "implementation files (user args, implementation.md, or source tree)"
70
73
  level: "WARN"
71
74
  message: "No implementation found. Run `/mvt-implement` first."
72
75
 
@@ -95,8 +98,21 @@ sections:
95
98
 
96
99
  - type: shared
97
100
  source: sections/session-update.md
101
+ params:
102
+ current_skill: mvt-test
98
103
 
99
104
  - type: shared
100
105
  source: sections/footer-next-steps.md
101
106
  params:
102
107
  current_skill: mvt-test
108
+ conditional_suggestions:
109
+ conditions:
110
+ - condition: "tests pass, implementation verified"
111
+ primary: mvt-review
112
+ primary_desc: "Final code review before merge"
113
+ - condition: "tests reveal bugs"
114
+ primary: mvt-fix
115
+ primary_desc: "Fix the issues found during testing"
116
+ - condition: "plan exists with remaining tasks"
117
+ primary: mvt-update-plan
118
+ primary_desc: "Mark current task done and advance to next"
@@ -23,43 +23,45 @@ Resolution rules:
23
23
  2. Parse YAML; if parse fails or schema is invalid -> stop and report. Do not attempt to repair silently.
24
24
  3. Verify the target `task_id` exists in `tasks[]`. If not, list valid ids and stop.
25
25
 
26
- ### Step 3: Apply the Update
26
+ ### Step 3: Apply the Update, Recompute, Validate, and Write (via script)
27
27
 
28
- Mutate the in-memory plan:
28
+ The mechanical work — mutating the task, recomputing `current_task` via the DAG
29
+ rules, validating the result, and writing back atomically — is performed by a
30
+ deterministic script. Do NOT hand-edit `plan.yaml` or reason through the
31
+ `current_task` selection yourself; call the script with the resolved arguments
32
+ from Step 1–2:
29
33
 
30
- 1. Find the target task; capture `old_status` for the report.
31
- 2. Set `tasks[i].status = new_status`.
32
- 3. If `artifacts` provided -> append to `tasks[i].artifacts` (de-duplicate).
33
- 4. If `notes` provided -> overwrite `tasks[i].notes`.
34
- 5. Update `plan.updated_at` to current ISO 8601 timestamp.
34
+ ```bash
35
+ node .ai-agents/scripts/plan-update.cjs --plan "<active_change.plan_path>" --task <task_id> --status <new_status> [--artifacts "<comma,separated,paths>"] [--notes "<note text>"]
36
+ ```
35
37
 
36
- ### Step 4: Recompute current_task
38
+ Include `--artifacts` only if artifacts were provided, and `--notes` only if a note was provided; omit each flag otherwise.
37
39
 
38
- Selection logic, in order:
40
+ | Argument | Value source |
41
+ |----------|-------------|
42
+ | `--plan` | `active_change.plan_path` resolved from session.yaml |
43
+ | `--task` | the `task_id` resolved in Step 1 |
44
+ | `--status` | the `new_status` resolved in Step 1 (`pending`/`in_progress`/`done`/`blocked`/`skipped`) |
45
+ | `--artifacts` | optional; comma-separated paths to append (the script de-duplicates) |
46
+ | `--notes` | optional; overwrites the task's `notes` |
39
47
 
40
- 1. If any task has status `in_progress` AND it is **not** the task we just changed to a terminal status (done/blocked/skipped) -> `current_task` = that task's id.
41
- 2. Otherwise pick the first task (by array order) where:
42
- - `status == pending`
43
- - All ids in `depends_on` reference tasks with status `done`
44
- 3. If no such task exists AND every task is `done` -> set `plan.status = done`, `current_task = null`.
45
- 4. If no such task exists but some tasks are still `pending` (because their dependencies are not done -- e.g., everything reachable is blocked) -> set `current_task = null`, leave `plan.status = in_progress`. Surface a warning in the output ("All remaining tasks are blocked by dependencies; resolve a blocker before continuing").
48
+ The script performs, deterministically:
46
49
 
47
- If the selected next task is currently `pending` -> promote it to `in_progress` (so the plan accurately reflects the active focus). Skip this promotion if `plan.status` just transitioned to `done`.
50
+ 1. **Apply**: sets the task status; appends + de-duplicates `--artifacts` (handles `artifacts: null`); overwrites `--notes`; sets `completed_at` to now when status is `done`, else `null`; refreshes `plan.updated_at`.
51
+ 2. **Recompute `current_task`** (same rules as before): an `in_progress` task that is not the one just moved to terminal wins; else the first `pending` task whose `depends_on` are all `done` (promoted to `in_progress`); else if all tasks are `done` set `plan.status = done` and `current_task = null`; else `current_task = null` with a blocked-by-dependencies warning.
52
+ 3. **Validate** the mutated plan (unique ids, valid `depends_on` references, DAG/no-cycle, ≤1 `in_progress`, every task has acceptance, `completed_at` consistency, `current_task` validity).
53
+ 4. **Write atomically** (temp + rename) only if validation passes.
48
54
 
49
- ### Step 5: Validate and Write
55
+ **Interpreting the result:**
50
56
 
51
- 1. Run the plan validator on the mutated structure.
52
- 2. If validation fails -> abort the write, report the validation errors, leave the original file untouched.
53
- 3. Otherwise, write back to `active_change.plan_path`.
57
+ - **Exit 0**: success. stdout is a single-line JSON object:
58
+ ```json
59
+ {"ok":true,"task":{"id":"t1","title":"...","old_status":"in_progress","new_status":"done"},"current_task":"t2","plan_status":"in_progress","progress":{"done":1,"total":4},"warning":null}
60
+ ```
61
+ Use these fields directly to render the Output Format block. The file is already written — do NOT read it back to verify. If `warning` is non-null, surface it.
62
+ - **Exit 1**: failure. stderr carries the error (invalid status, task not found, validation failure, parse/write error). The file was **not** modified. Report the error to the user and do not fabricate a success summary.
54
63
 
55
- ### Step 6: Update Session State
56
-
57
- Apply the standard State Update rules (see shared section above) AND the update-plan-specific updates:
58
-
59
- - Refresh the matching entry in `recent_changes[]`: `last_updated` -> current ISO 8601 timestamp.
60
- - Do NOT touch `active_change.has_plan` / `active_change.plan_path`.
61
-
62
- ### Step 7: Output
64
+ ### Step 4: Output
63
65
 
64
66
  Emit the Plan Update summary block defined in the Output Format section. Include:
65
67
 
@@ -70,3 +72,14 @@ Emit the Plan Update summary block defined in the Output Format section. Include
70
72
  - If a new `current_task` is set -> recommend the skill matching its `skill_hint`.
71
73
  - If plan complete -> recommend `/mvt-cleanup` or starting a new change via `/mvt-analyze`.
72
74
  - If all remaining tasks are blocked -> recommend resolving the blocker (point at the `notes` of the blocked task).
75
+
76
+ ## Edge Cases & Errors
77
+
78
+ | Case | Handling |
79
+ |------|----------|
80
+ | `plan.yaml` not found at `active_change.plan_path` | Abort with error: "No plan found. Run `/mvt-plan-dev` to create one." |
81
+ | Task id provided does not exist in `plan.yaml` | Abort with error listing valid task ids |
82
+ | Transition to `done` but `depends_on` tasks are not all `done` | Warn but allow: "Task marked done despite unfinished dependencies — verify correctness" |
83
+ | All tasks are `done` but user marks another as `in_progress` | Reject: plan is already complete; suggest creating a new change |
84
+ | Circular dependency detected in `depends_on` | Report the cycle and refuse to auto-advance `current_task`; suggest manual fix |
85
+ | `plan.yaml` write fails (permission denied, invalid YAML state) | Abort; do not update session; report the write error |
@@ -24,7 +24,7 @@ sections:
24
24
  - rule: "Task id missing AND only one task is in_progress -> Default to that task"
25
25
  - rule: "Target status would create an invalid current_task -> Recompute current_task automatically"
26
26
  - rule: "All tasks become done -> Set plan.status = done, current_task = null"
27
- - rule: "active_change.has_plan is false -> Stop and suggest /mvt-plan-dev"
27
+ - rule: "active_change.plan_path is empty -> Stop and suggest /mvt-plan-dev"
28
28
 
29
29
  boundaries:
30
30
  - scope: "create new tasks or restructure the plan"
@@ -46,6 +46,9 @@ sections:
46
46
  - type: shared
47
47
  source: sections/output-language-constraint.md
48
48
 
49
+ - type: shared
50
+ source: sections/output-format-constraint.md
51
+
49
52
  - type: shared
50
53
  source: sections/activation-preflight.md
51
54
  params:
@@ -55,16 +58,17 @@ sections:
55
58
  level: "WARN"
56
59
  message: 'Session not initialized. Run `/mvt-init` first.'
57
60
  - order: "2"
58
- field: "active_change.has_plan"
61
+ field: "active_change.plan_path"
59
62
  level: "BLOCK"
60
- message: 'No active plan. Run `/mvt-plan-dev` to create one before updating.'
63
+ message: 'No active plan. Run `/mvt-plan-dev` to create one.'
61
64
 
62
65
  - type: inline
63
66
  content: |
64
- ### Shortcut Operation Rules
65
- - Can execute at any time when an active plan exists
66
- - Performs surgical edits only -- never overwrites the whole plan structure
67
- - Re-validates the resulting plan before writing; aborts on validation failure
67
+ ## Operation Mode: Shortcut
68
+
69
+ This skill operates as a shortcut it can execute at any time when an active plan exists.
70
+ - Performs surgical edits only never overwrites the whole plan structure.
71
+ - Re-validates the resulting plan before writing; aborts on validation failure.
68
72
 
69
73
  - type: file
70
74
  source: ./business.md
@@ -100,18 +104,9 @@ sections:
100
104
 
101
105
  - type: shared
102
106
  source: sections/session-update.md
103
-
104
- - type: inline
105
- content: |
106
- ### Update-Plan Specific State Updates
107
-
108
- In addition to the mandatory updates above, this skill MUST refresh `recent_changes` for the active change:
109
-
110
- - Find the entry where `id == active_change.id`. If absent, append one (this should be rare; happens when the plan was created out-of-band).
111
- - Set `last_updated` to the current ISO 8601 timestamp.
112
- - Trim to max 5 entries (drop the oldest by `last_updated` ascending).
113
-
114
- Do NOT modify `active_change.has_plan` or `active_change.plan_path` here -- those are owned by `/mvt-plan-dev`.
107
+ params:
108
+ current_skill: mvt-update-plan
109
+ update_change: true
115
110
 
116
111
  - type: shared
117
112
  source: sections/footer-next-steps.md
@@ -1,26 +0,0 @@
1
- export interface PlanValidationError {
2
- path: string;
3
- message: string;
4
- }
5
- export interface PlanTask {
6
- id: string;
7
- title: string;
8
- status: string;
9
- depends_on: string[];
10
- skill_hint?: string;
11
- acceptance?: string[];
12
- artifacts?: string[];
13
- notes?: string;
14
- }
15
- export interface Plan {
16
- version: number;
17
- change_id: string;
18
- title: string;
19
- created_at: string;
20
- updated_at: string;
21
- status: string;
22
- current_task: string | null;
23
- tasks: PlanTask[];
24
- }
25
- export declare function validatePlan(rawYaml: string): PlanValidationError[];
26
- //# sourceMappingURL=plan-validator.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"plan-validator.d.ts","sourceRoot":"","sources":["../../src/build/plan-validator.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,QAAQ;IACvB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,IAAI;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;IAC5B,KAAK,EAAE,QAAQ,EAAE,CAAC;CACnB;AAsID,wBAAgB,YAAY,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,EAAE,CA+GnE"}