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

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 (96) hide show
  1. package/README.md +299 -64
  2. package/README.zh-CN.md +419 -0
  3. package/dist/commands/install.d.ts.map +1 -1
  4. package/dist/commands/install.js +27 -2
  5. package/dist/commands/install.js.map +1 -1
  6. package/dist/commands/uninstall.d.ts.map +1 -1
  7. package/dist/commands/uninstall.js +19 -7
  8. package/dist/commands/uninstall.js.map +1 -1
  9. package/dist/commands/update.d.ts.map +1 -1
  10. package/dist/commands/update.js +4 -2
  11. package/dist/commands/update.js.map +1 -1
  12. package/dist/fs/install-manifest.d.ts +4 -1
  13. package/dist/fs/install-manifest.d.ts.map +1 -1
  14. package/dist/fs/install-manifest.js +13 -1
  15. package/dist/fs/install-manifest.js.map +1 -1
  16. package/dist/fs/materialize.d.ts +2 -0
  17. package/dist/fs/materialize.d.ts.map +1 -1
  18. package/dist/fs/materialize.js +46 -13
  19. package/dist/fs/materialize.js.map +1 -1
  20. package/dist/fs/registry-merge.d.ts +19 -0
  21. package/dist/fs/registry-merge.d.ts.map +1 -0
  22. package/dist/fs/registry-merge.js +220 -0
  23. package/dist/fs/registry-merge.js.map +1 -0
  24. package/dist/scripts/epic-update.cjs +7670 -0
  25. package/dist/scripts/plan-update.cjs +7736 -0
  26. package/dist/scripts/session-update.cjs +84 -6
  27. package/dist/types/platform.d.ts +12 -0
  28. package/dist/types/platform.d.ts.map +1 -0
  29. package/dist/types/platform.js +24 -0
  30. package/dist/types/platform.js.map +1 -0
  31. package/dist/types/registry.d.ts +3 -24
  32. package/dist/types/registry.d.ts.map +1 -1
  33. package/install-manifest.yaml +10 -2
  34. package/package.json +1 -1
  35. package/registry.yaml +72 -198
  36. package/sources/defaults/config.yaml +8 -13
  37. package/sources/defaults/project-context.yaml +2 -5
  38. package/sources/defaults/session.yaml +14 -2
  39. package/sources/knowledge/core/manifest.yaml +1 -4
  40. package/sources/scripts/epic-update.js +512 -0
  41. package/sources/scripts/plan-update.js +614 -0
  42. package/sources/scripts/session-update.js +102 -2
  43. package/sources/sections/activation-load-config.md +1 -1
  44. package/sources/sections/activation-load-context.md +42 -13
  45. package/sources/sections/activation-preflight.md +1 -1
  46. package/sources/sections/footer-next-steps.md +3 -2
  47. package/sources/sections/output-format-constraint.md +14 -0
  48. package/sources/sections/project-context-profile.md +29 -0
  49. package/sources/sections/session-update.md +41 -1
  50. package/sources/skills/mvt-analyze/business.md +46 -8
  51. package/sources/skills/mvt-analyze/manifest.yaml +8 -1
  52. package/sources/skills/mvt-analyze-code/business.md +18 -17
  53. package/sources/skills/mvt-analyze-code/manifest.yaml +9 -6
  54. package/sources/skills/mvt-check-context/business.md +13 -6
  55. package/sources/skills/mvt-check-context/manifest.yaml +0 -5
  56. package/sources/skills/mvt-cleanup/business.md +17 -2
  57. package/sources/skills/mvt-cleanup/manifest.yaml +3 -0
  58. package/sources/skills/mvt-config/business.md +5 -5
  59. package/sources/skills/mvt-config/manifest.yaml +3 -6
  60. package/sources/skills/mvt-create-skill/business.md +2 -14
  61. package/sources/skills/mvt-create-skill/manifest.yaml +2 -4
  62. package/sources/skills/mvt-decompose/business.md +94 -0
  63. package/sources/skills/mvt-decompose/manifest.yaml +121 -0
  64. package/sources/skills/mvt-design/manifest.yaml +3 -0
  65. package/sources/skills/mvt-fix/business.md +21 -6
  66. package/sources/skills/mvt-fix/manifest.yaml +4 -1
  67. package/sources/skills/mvt-help/business.md +11 -9
  68. package/sources/skills/mvt-help/manifest.yaml +0 -5
  69. package/sources/skills/mvt-implement/business.md +57 -10
  70. package/sources/skills/mvt-implement/manifest.yaml +3 -0
  71. package/sources/skills/mvt-init/business.md +23 -13
  72. package/sources/skills/mvt-init/manifest.yaml +4 -2
  73. package/sources/skills/mvt-manage-context/business.md +41 -14
  74. package/sources/skills/mvt-manage-context/manifest.yaml +7 -5
  75. package/sources/skills/mvt-plan-dev/business.md +17 -9
  76. package/sources/skills/mvt-plan-dev/manifest.yaml +3 -0
  77. package/sources/skills/mvt-quick-dev/business.md +22 -7
  78. package/sources/skills/mvt-quick-dev/manifest.yaml +3 -1
  79. package/sources/skills/mvt-refactor/business.md +32 -17
  80. package/sources/skills/mvt-refactor/manifest.yaml +2 -4
  81. package/sources/skills/mvt-resume/business.md +32 -12
  82. package/sources/skills/mvt-resume/manifest.yaml +3 -3
  83. package/sources/skills/mvt-review/business.md +24 -9
  84. package/sources/skills/mvt-review/manifest.yaml +3 -0
  85. package/sources/skills/mvt-status/business.md +37 -9
  86. package/sources/skills/mvt-status/manifest.yaml +2 -2
  87. package/sources/skills/mvt-sync-context/business.md +77 -34
  88. package/sources/skills/mvt-sync-context/manifest.yaml +6 -0
  89. package/sources/skills/mvt-template/business.md +1 -1
  90. package/sources/skills/mvt-template/manifest.yaml +0 -5
  91. package/sources/skills/mvt-test/business.md +30 -15
  92. package/sources/skills/mvt-test/manifest.yaml +3 -0
  93. package/sources/skills/mvt-update-plan/business.md +64 -33
  94. package/sources/skills/mvt-update-plan/manifest.yaml +10 -7
  95. package/sources/templates/decompose-output/body.md +13 -0
  96. package/sources/templates/decompose-output/manifest.yaml +11 -0
@@ -5,7 +5,7 @@
5
5
  - The actual source files referenced in the design's `File Structure` and `Change Tracking` sections.
6
6
  - **Fallback**:
7
7
  - If `design.md` is missing, surface a WARN and ask the user whether to (a) run `/mvt-design` first or (b) proceed using their conversational description as the design (mark artifact with "Source: conversation only").
8
- - If `coding-standards.md` is missing, fall back to language/framework defaults inferred from `project-context.yaml`.
8
+ - If coding standards are not loaded by activation, fall back to language/framework defaults inferred from `project-context.yaml`.
9
9
 
10
10
  ### Step 2: Plan the Implementation
11
11
  - **What**: produce an ordered file list with the smallest possible commit boundary per group.
@@ -14,7 +14,7 @@
14
14
  2. Topologically order files by dependency: domain entities -> repositories/adapters -> use-case/services -> controllers/UI.
15
15
  3. Group consecutive files that share a single conceptual change into one commit boundary.
16
16
  4. For each file, decide: `create | modify | delete`, and write a one-line intent.
17
- - **Plan-aware behavior**: if `plan.yaml` is present, restrict scope to the files implied by `current_task` (cross-reference `plan.tasks[*].artifacts.files`); do NOT silently expand into other tasks.
17
+ - **Plan-aware behavior**: if `plan.yaml` is present, identify the active task from `current_tasks` (the entry matching the current project, or the sole entry in single-project mode), then treat that task's `artifacts.files` (cross-reference `plan.tasks[*].artifacts.files`) as a **starting-scope hint, not a hard ceiling**. The source of truth for scope remains `design.md`'s `Change Tracking` (per Step 2.1). When `artifacts.files` is `null` or empty, derive scope entirely from `Change Tracking`. If implementation reveals files beyond this hint are genuinely required, do NOT silently expand surface them via Step 3 confirmation and never absorb files that clearly belong to a different task.
18
18
  - **Output of this step**: an in-conversation list shown to user as a preview, with no write yet.
19
19
 
20
20
  ### Step 3: Confirm Scope (when needed)
@@ -23,6 +23,7 @@
23
23
  - The plan introduces a new public API (exported symbol, HTTP endpoint, CLI flag).
24
24
  - The plan deletes existing code (delete count > 0).
25
25
  - The plan deviates from `design.md` (e.g., adds files not in `Change Tracking` or skips files listed there).
26
+ - The plan touches files beyond the active task's `artifacts.files` hint (state which files are added and why, in one line each).
26
27
  - **Otherwise**: proceed silently.
27
28
  - **On deviation from design**: explain the deviation reason in one line; if the deviation is structural (new module, layer change, interface break), STOP and recommend re-running `/mvt-design`.
28
29
 
@@ -30,7 +31,7 @@
30
31
  - **What**: write/modify the planned files, one commit-group at a time.
31
32
  - **How**:
32
33
  1. For each commit-group: write all files, then move on. Do not interleave groups.
33
- 2. Follow `coding-standards.md`. Match the surrounding code style if standards are silent.
34
+ 2. Follow the coding standards loaded by activation (if any). Match the surrounding code style if standards are silent.
34
35
  3. Respect module/layer rules from `project-context.md`. Forbidden imports must NOT appear; use the abstractions defined in `design.md`'s `Key Interfaces`.
35
36
  4. Add error handling at system boundaries only (HTTP, DB, external API, file IO, message bus). Do NOT add try/catch around internal calls "just in case".
36
37
  5. Inline comments only for: non-obvious algorithmic choices, deliberate workarounds with a reason, interface contracts not expressible in code. Never narrate WHAT the code does.
@@ -59,7 +60,12 @@
59
60
  3. UI/frontend changes: per project rules, ask user to verify in browser; do NOT claim "tested" if you only ran type-check.
60
61
 
61
62
  ### Step 7: Write Artifact
62
- - **Path and template**: as defined in the **Artifact Structure** section below.
63
+ - **Path and template**: as defined in the **Artifact Structure** section below. The artifact filename is ALWAYS `implementation.md` — one file per change, never per task. Do NOT invent task-suffixed names like `implementation-t1.md`.
64
+ - **Multi-task plans (single-file accumulation)**: when `plan.yaml` drives the change and you implement tasks across separate invocations, all task implementations accumulate into the **same** `implementation.md`:
65
+ 1. If `implementation.md` does not yet exist -> create it from the template.
66
+ 2. If it already exists -> read it, then **append** a new `## Task: {current_task_id} — {task_title}` section for this task. Do NOT overwrite prior tasks' sections.
67
+ 3. Under that task section, place this invocation's required content (the headings below). Keep earlier tasks' sections intact.
68
+ 4. For single-task or plan-less changes, write the content at the top level without a per-task wrapper (existing behavior).
63
69
  - **Required content** (mapped to template headings):
64
70
  - `Implementation Summary` -- one paragraph: what was built, scope.
65
71
  - `Files Touched` -- table: path | create/modify/delete | one-line intent.
@@ -69,14 +75,53 @@
69
75
  - `Open TODOs` -- anything deferred for `/mvt-review`, `/mvt-test`, or follow-up changes.
70
76
  - The actual source code goes to the project tree; the artifact is a record, not the code itself.
71
77
 
72
- ### Step 8: Plan-Aware Progress Hint (if applicable)
73
- - If `plan.yaml` exists and a single `current_task` covers this implementation, suggest the user run `/mvt-update-plan <task-id> done` (or `blocked` with reason).
78
+ ### Step 8: Deliverables Handoff (if applicable)
79
+
80
+ **SKIP this step entirely** (go directly to Step 9) if ANY of the following is true:
81
+ - No `plan.yaml` exists for the active change (`active_change.plan_path` is empty or the file does not exist).
82
+ - No task in `plan.tasks[]` has a `depends_on` entry that includes the current task id (i.e., the current task has zero downstream dependents).
83
+
84
+ > These are hard guards. Do NOT prompt the user about deliverables unless BOTH guards pass.
85
+
86
+ - **Prompt the user**:
87
+ - If `task.deliverables` already exists (re-implementation / rescope): "Implementation changed, and downstream task(s) {ids} depend on it. Update deliverables? (y/n)"
88
+ - If this is the first time (no `deliverables` field on the task): "Downstream task(s) {ids} will consume this task's output. Generate deliverables? (default y)"
89
+ - **On confirmation**, append a deliverables subsection under the task's existing `## Task: {id}` section in `implementation.md` (if multi-task plan) or as a dedicated section (if single-task). Use this soft skeleton:
90
+
91
+ ```markdown
92
+ ### Deliverables
93
+
94
+ #### Public Interface
95
+ {Describe exported symbols, function signatures, endpoint contracts that downstream tasks rely on.}
96
+
97
+ #### Data Shapes
98
+ {Describe data structures, types, schemas that flow between this task and downstream consumers.}
99
+
100
+ #### Usage Constraints
101
+ {Document invariants, preconditions, or side effects that downstream tasks must respect.}
102
+ ```
103
+
104
+ - **After writing deliverables**, call `plan-update.cjs` with both flags in a single invocation:
105
+ ```bash
106
+ node .ai-agents/scripts/plan-update.cjs \
107
+ --plan "<active_change.plan_path>" \
108
+ --task <current_task_id> \
109
+ --status <current_status> \
110
+ --deliverables-pointer current \
111
+ --mark-deliverable-stale <downstream_task_id1>[,<downstream_task_id2>,...] \
112
+ --projects <project_list>
113
+ ```
114
+ `<project_list>` is the comma-separated project names from `plan.yaml > current_tasks` keys. In a single-project workspace this is `default`. The `--projects` flag ensures per-project validation runs correctly in multi-project plans.
115
+ The `--status` must be the task's current status (typically `in_progress` at this point, since Step 9 has not yet run). Pass ALL downstream dependent task ids as a comma-separated list to `--mark-deliverable-stale` so that `/mvt-resume` and `/mvt-status` can surface the stale warning.
116
+ - **On user decline**: do not write deliverables and do not call `plan-update.cjs` with the deliverables flags. The downstream tasks will not receive stale warnings, which is acceptable if the user considers the contract unchanged.
117
+ - **Error handling**: if `plan-update.cjs` rejects (e.g., malformed freshness), surface stderr and leave `implementation.md` as written. The deliverables content is the source of truth; the pointer can be retried via `/mvt-update-plan`.
118
+
119
+ ### Step 9: Plan-Aware Progress Hint (if applicable)
120
+ - If `plan.yaml` exists and `current_tasks` identifies the active task for this implementation, suggest the user run `/mvt-update-plan <task-id> done` (or `blocked` with reason).
121
+ - If the files actually touched differ from the active task's `artifacts.files` (extra files added during Step 3, or planned files left untouched), explicitly remind the user to run `/mvt-update-plan` so the plan's `artifacts.files` reflects reality for `/mvt-resume` and future sessions.
74
122
  - Do NOT modify `plan.yaml` directly from this skill; it is owned by `/mvt-update-plan`.
75
123
  - Do NOT modify `changes` directly; it is owned by `/mvt-plan-dev` / `/mvt-update-plan`.
76
124
 
77
- ### Step 9: State Update
78
- Apply the State Update rules defined in the **State Update** section below.
79
-
80
125
  ## Edge Cases & Errors
81
126
 
82
127
  | Case | Handling |
@@ -87,4 +132,6 @@ Apply the State Update rules defined in the **State Update** section below.
87
132
  | User aborts at Step 3 confirmation | Do not write any source files or artifact |
88
133
  | File listed in `Change Tracking` no longer exists in the working tree | Surface, ask user whether design is stale or file was deleted in a parallel change |
89
134
  | Implementation must touch a file outside the active project (other repo / submodule) | STOP -- this is out of scope for `/mvt-implement`; surface and ask user to plan it as a separate change |
90
- | Plan task is `blocked` or `done` already | Refuse to implement that task; ask user to pick another `current_task` or run `/mvt-update-plan` |
135
+ | Plan task is `blocked` or `done` already | Refuse to implement that task; ask user to pick another task from `current_tasks` or run `/mvt-update-plan` |
136
+ | Deliverables already exist and user declines to update | Leave existing deliverables in place; do not call `plan-update.cjs` with deliverables flags |
137
+ | `plan-update.cjs` rejects deliverables pointer | Surface error; leave `implementation.md` as written (content is source of truth, pointer can be retried) |
@@ -43,6 +43,9 @@ sections:
43
43
  - type: shared
44
44
  source: sections/output-language-constraint.md
45
45
 
46
+ - type: shared
47
+ source: sections/output-format-constraint.md
48
+
46
49
  - type: shared
47
50
  source: sections/activation-preflight.md
48
51
  params:
@@ -89,6 +89,8 @@ For each project:
89
89
  - Name, path, type
90
90
  - Tech stack (language, framework, build tool, test framework)
91
91
 
92
+ **Project naming constraint**: each project name must match `[a-zA-Z0-9][a-zA-Z0-9_-]*` (no leading underscore). Validate all detected names against this constraint; if a name violates it (e.g., auto-detected as `_internal`), prompt the user to provide a valid alternative before proceeding.
93
+
92
94
  Wait for user to confirm or adjust:
93
95
  - `yes` -- Accept all
94
96
  - Provide corrections -- User specifies which fields to change
@@ -112,6 +114,7 @@ For each target file, check if it already exists:
112
114
  - name: "{project_name}"
113
115
  path: "{relative_path}"
114
116
  type: "{project_type}"
117
+ source_paths: []
115
118
  tech_stack:
116
119
  primary_language: "{language}"
117
120
  secondary_languages: [{...}]
@@ -119,6 +122,7 @@ For each target file, check if it already exists:
119
122
  build_tool: "{build_tool}"
120
123
  test_framework: "{test_framework}"
121
124
  ```
125
+ `source_paths` is populated by `/mvt-analyze-code` based on analyzed code structure. On initial `/mvt-init`, leave as empty array.
122
126
  For multi-project repos, include one entry per detected project.
123
127
 
124
128
  #### 5.3 Post-write validation
@@ -126,34 +130,40 @@ For each target file, check if it already exists:
126
130
  After writing all files, validate:
127
131
  - `project-context.yaml` is valid YAML with `projects[]` containing at least one entry
128
132
  - Each project entry has required fields: `name`, `path`, `type`, `tech_stack.primary_language`
129
- - `session.yaml` is structurally intact and contains: `session` (with `initialized_at`, `last_synced_at`), `active_change` (with `plan_path`), `changes` (array), `history`
130
133
 
131
134
  If any validation fails → report the specific error and offer to retry or skip.
132
135
 
133
- ### Step 6: Refresh Mode Handling (--refresh only)
136
+ ### Step 6: Refresh Mode Handling (Interactive)
137
+
138
+ When `mvt-init` is executed and existing MVTT artifacts are detected:
139
+
140
+ 1. **Prompt user**: "Existing MVTT configuration found. Refresh to re-scan project structure? (y/n)"
141
+ - If `n` -> stop, no changes made.
142
+ - If `y` -> proceed with refresh.
143
+
144
+ 2. **Re-scan** project structure using Steps 1-3 above.
134
145
 
135
- When `--refresh` is specified:
146
+ 3. **Compare** new vs existing `projects[]`. If project changes detected (added/removed/renamed sub-projects):
147
+ - Show diff: "+N added / -N removed / ~N renamed"
148
+ - Confirm before writing.
136
149
 
137
- 1. **Preserve** the following from existing files:
150
+ 4. **Preserve** the following from existing files:
138
151
  - `session.yaml` > `history`
139
152
  - `project-context.yaml` > any user-added custom fields (fields not in the standard schema)
140
153
  - `config.yaml` > `preferences` section
141
154
 
142
- 2. **Update** only auto-detectable fields:
155
+ 5. **Update** only auto-detectable fields:
143
156
  - `tech_stack` (re-scan and update)
144
157
  - `type` (re-infer)
158
+ - `source_paths` (re-scan)
145
159
 
146
- 3. **Diff and confirm**: Show a summary of what will change vs what will be preserved. Ask for confirmation before writing.
160
+ 6. **After writing** -> prompt: "Project structure updated. Recommend running `/mvt-analyze-code` to sync semantic context."
147
161
 
148
- 4. **Old format migration**: If existing `project-context.yaml` uses old format (has top-level `project`, `requirements`, `architecture`, `environment` keys):
149
- - Wrap `project.*` as `projects[0]` with `name="default"`, `path="."`
150
- - Discard `requirements`, `architecture` sections -- suggest running `/mvt-analyze-code` to regenerate
151
- - Discard `environment` section
152
- - Discard any `pattern` related fields
162
+ 7. **Orphan knowledge entries**: After refresh, if any knowledge entries in `registry.yaml` reference a project name not in the updated `projects[]`, prompt: "N orphan knowledge entries found for project(s) not in projects list: {names}. Consider `/mvt-manage-context remove` to clean up."
153
163
 
154
164
  ### Step 7: Determine Project State (drives next-step recommendation)
155
165
 
156
- After Step 5 writes are committed, classify the project state to select the appropriate next_suggestions branch from registry.yaml:
166
+ After Step 5 writes are committed, classify the project state to select the appropriate recommendation branch in the **Suggested Next Steps** section below:
157
167
 
158
168
  | Condition | Detection logic |
159
169
  |-----------|-----------------|
@@ -161,4 +171,4 @@ After Step 5 writes are committed, classify the project state to select the appr
161
171
  | `empty_project` | Step 1 found no source files AND no package manager file (truly empty or docs-only repo) -- the recommended next step is `/mvt-manage-context` to manually capture context |
162
172
  | `default` | Neither condition matched (rare -- fallback path) |
163
173
 
164
- Pass the resolved condition to the output template so the suggested next steps section renders the matching branch from `registry.yaml > skills.mvt-init.next_suggestions.conditional[]`.
174
+ Use the resolved condition to render the matching branch in the **Suggested Next Steps** section (Conditional Recommendations).
@@ -43,8 +43,7 @@ sections:
43
43
 
44
44
  | Variant | Description |
45
45
  |---------|-------------|
46
- | `/mvt-init` | Standard initialization (scan + detect + write index) |
47
- | `/mvt-init --refresh` | Re-scan existing project -- preserve user state, update auto-detectable fields, show diff before writing |
46
+ | `/mvt-init` | Standard initialization or interactive refresh (scan + detect + write index; re-scan on existing project with user confirmation) |
48
47
 
49
48
  - type: shared
50
49
  source: sections/activation-load-context.md
@@ -59,6 +58,9 @@ sections:
59
58
  - type: shared
60
59
  source: sections/output-language-constraint.md
61
60
 
61
+ - type: shared
62
+ source: sections/output-format-constraint.md
63
+
62
64
  - type: shared
63
65
  source: sections/activation-preflight.md
64
66
  params:
@@ -19,6 +19,21 @@ For interactive menu, present the five options and wait for user choice, then en
19
19
 
20
20
  Switch to the matching section below.
21
21
 
22
+ ### Map-Aware Knowledge Structure
23
+
24
+ The registry uses project-keyed knowledge maps. Every knowledge block (top-level `knowledge` and each `skills.<name>.knowledge`) is a map where keys are project names or the reserved `_all` key (all projects). All subcommands must operate on this map structure.
25
+
26
+ **Two-question routing table (add subcommand)**:
27
+
28
+ | Question 1: Scope | Question 2: Breadth | Registry key path |
29
+ |--------------------|---------------------|-------------------|
30
+ | global | all skills | `knowledge._all` |
31
+ | project-specific | all skills | `knowledge.{projectName}` |
32
+ | global | specific skill | `skills.{name}.knowledge._all` |
33
+ | project-specific | specific skill | `skills.{name}.knowledge.{projectName}` |
34
+
35
+ **`_all` promotion confirmation**: routing to `knowledge._all` or `skills.{name}.knowledge._all` means the entry will be loaded by every skill across every project (or every project for that skill). When the add flow routes to `_all`, prompt: "This knowledge will be loaded by ALL skills across ALL projects. Confirm? (y/n)" -- default to **n** for project-specific entries, default to **y** only when the user explicitly chose scope=global.
36
+
22
37
  ---
23
38
 
24
39
  ## Subcommand: add
@@ -36,24 +51,31 @@ Classify the content into one of:
36
51
 
37
52
  The skill should suggest a type based on content keywords; the user confirms or overrides.
38
53
 
39
- ### 2.3 AI Routing -- Score every skill
54
+ ### 2.3 AI Routing -- Two-question routing + skill scoring
40
55
 
41
- 1. Read `.ai-agents/registry.yaml` > `skills.*` -- collect every skill's `name` and `description`.
42
- 2. For each skill, score relevance to the content on a 0-100 scale:
56
+ 1. **Question 1: Scope** -- Ask: "Is this knowledge global (applies to all projects) or project-specific?"
57
+ - `global` -> keys under `_all`
58
+ - `project-specific` -> ask which project (list from `project-context.yaml > projects[].name`); key under `{projectName}`
59
+ 2. **Question 2: Breadth** -- Ask: "Should this knowledge be loaded by all skills or a specific skill?"
60
+ - `all skills` -> top-level `knowledge` map
61
+ - `specific skill` -> AI-score each skill for relevance (see below)
62
+ 3. Read `.ai-agents/registry.yaml` > `skills.*` -- collect every skill's `name` and `description`.
63
+ 4. For each skill, score relevance to the content on a 0-100 scale:
43
64
  - 90-100: directly aligned (e.g., review rules + `mvt-review`)
44
65
  - 70-89: strongly relevant
45
66
  - 50-69: tangentially relevant
46
67
  - 0-49: weak match
47
- 3. Read `.ai-agents/config.yaml` > `preferences.context_routing.relevance_threshold` (default 70 if missing).
48
- 4. Display **all** skills sorted by score descending. Do not truncate -- the user sees the full list with scores.
68
+ 5. Read `.ai-agents/config.yaml` > `preferences.context_routing.relevance_threshold` (default 70 if missing).
69
+ 6. Display **all** skills sorted by score descending. Do not truncate -- the user sees the full list with scores.
49
70
  - Skills at or above threshold: pre-checked, shown with `[High]` / `[Med]` markers (or stars in emoji mode).
50
71
  - Skills below threshold: collapsed under an "expand" prompt; not pre-checked.
72
+ 7. Combine the two questions with the scoring to determine the registry key path per the routing table above.
51
73
 
52
74
  ### 2.4 Accept user input
53
75
  Accept any of:
54
76
  - `Enter` (empty input) -- confirm pre-checked selection
55
77
  - Comma-separated indices (e.g. `1,3,5`) -- custom skill selection
56
- - `s` -- promote to **shared** (write to `registry.yaml > knowledge.shared`)
78
+ - `s` -- promote to **global** (write to `registry.yaml > knowledge._all`)
57
79
  - `c` -- promote to **core** (write to `.ai-agents/knowledge/core/user/{filename}` + append entry to `core/manifest.yaml` with `origin: user`)
58
80
  - `n` -- **none** (file-only; not auto-loaded)
59
81
  - `m` -- **manual** mode (display the full skill list including below-threshold for direct picking)
@@ -63,8 +85,8 @@ Accept any of:
63
85
 
64
86
  | User choice | File destination | Registry / manifest update |
65
87
  |------------|-----------------|----------------------------|
66
- | Per-skill (any subset) | `.ai-agents/knowledge/{type}/{filename}` (`type` = `principle` or `project`) | For each chosen skill: append entry to `registry.yaml > skills.{name}.knowledge[]` with `type: static`, `source: knowledge/{type}/`, `files: [{filename}]` |
67
- | `s` (shared) | `.ai-agents/knowledge/{type}/{filename}` | Append to `registry.yaml > knowledge.shared[]` with the same `type: static` shape |
88
+ | Per-skill (any subset) | `.ai-agents/knowledge/{type}/{filename}` (`type` = `principle` or `project`) | For each chosen skill: append entry to `registry.yaml > skills.{name}.knowledge.{projectKey}[]` with `type: static`, `source: knowledge/{type}/`, `files: [{filename}]`. `projectKey` = `_all` if scope=global, or `{projectName}` if project-specific. |
89
+ | `s` (shared / global + all skills) | `.ai-agents/knowledge/{type}/{filename}` | Append to `registry.yaml > knowledge._all[]` with the same `type: static` shape |
68
90
  | `c` (core) | `.ai-agents/knowledge/core/user/{filename}` | Append to `core/manifest.yaml > files[]` with `path: user/{filename}`, `origin: user`, `auto_load: true` |
69
91
  | `n` (none) | `.ai-agents/knowledge/{type}/{filename}` | No registry/manifest change |
70
92
 
@@ -93,8 +115,10 @@ Use the `add / move / rename` output format from the manifest. Show:
93
115
  Show the entry's file path, all binding references (shared / per-skill / core), and ask user to confirm.
94
116
 
95
117
  ### 3.3 Drop references
96
- - `registry.yaml > knowledge.shared[]` -- remove entries whose path matches
97
- - `registry.yaml > skills.*.knowledge[]` -- remove every per-skill entry whose path matches
118
+ - `registry.yaml > knowledge._all[]` -- remove entries whose path matches
119
+ - `registry.yaml > knowledge.{projectName}[]` -- traverse ALL project keys, remove entries whose path matches
120
+ - `registry.yaml > skills.*.knowledge._all[]` -- remove every per-skill _all entry whose path matches
121
+ - `registry.yaml > skills.*.knowledge.{projectName}[]` -- traverse ALL project keys for each skill, remove entries whose path matches
98
122
  - `core/manifest.yaml > files[]` -- if the file lives under `core/user/`, remove the matching entry
99
123
 
100
124
  ### 3.4 Delete file
@@ -115,7 +139,10 @@ Use the `remove` output format. Show every reference dropped.
115
139
  Display where the entry is currently bound (shared / per-skill / core / none).
116
140
 
117
141
  ### 4.3 Prompt for new binding
118
- Use the same UI as `add` step 2.4 (Enter / indices / `s` / `c` / `n`).
142
+ Use the same two-question routing as `add` step 2.3 (Scope + Breadth -> registry key path). Support cross-key movement:
143
+ - `_all` -> `{projectName}` (narrow from global to project-specific)
144
+ - `{projectName}` -> `_all` (promote to global; apply `_all` promotion confirmation)
145
+ - `{projectName1}` -> `{projectName2}` (move between projects)
119
146
 
120
147
  ### 4.4 Apply changes
121
148
  - Update registry / manifest references atomically:
@@ -151,14 +178,14 @@ Use the `add / move / rename` output format.
151
178
  ## Subcommand: list
152
179
 
153
180
  ### 6.1 Read sources
154
- - `.ai-agents/registry.yaml` > `knowledge.shared[]` and `skills.*.knowledge[]`
181
+ - `.ai-agents/registry.yaml` > `knowledge._all[]`, `knowledge.{projectName}[]`, `skills.*.knowledge._all[]`, `skills.*.knowledge.{projectName}[]` -- traverse ALL project keys
155
182
  - `.ai-agents/knowledge/core/manifest.yaml` > `files[]`
156
183
  - Walk `.ai-agents/knowledge/{principle,project}/` for files not referenced anywhere (Unbound)
157
184
 
158
185
  ### 6.2 Group and render
159
- Use the `list` output format. Each row should answer: where is the file, and which skills load it?
186
+ Use the `list` output format. Group by **project x skill** (3D table). Each row should answer: where is the file, which project(s) does it serve, and which skills load it?
160
187
 
161
- For Per-Skill rows, list every skill that binds to the file (a single file can be bound to multiple skills).
188
+ Flag **orphan entries** -- entries under a project key not in `projects[].name` from `project-context.yaml`.
162
189
 
163
190
  ### 6.3 Health hints
164
191
  At the bottom of the list, optionally surface:
@@ -14,6 +14,9 @@ sections:
14
14
 
15
15
  Unified CRUD entry point for project context and knowledge entries. Handles add (with AI-driven skill routing), remove, move, rename, and list operations across `project-context.yaml`, `project-context.md`, `knowledge/principle/`, `knowledge/project/`, `knowledge/core/user/`, and the corresponding `registry.yaml` / `core/manifest.yaml` references.
16
16
 
17
+ - type: shared
18
+ source: sections/project-context-profile.md
19
+
17
20
  - type: shared
18
21
  source: sections/role-header.md
19
22
  params:
@@ -46,10 +49,8 @@ sections:
46
49
  - type: shared
47
50
  source: sections/output-language-constraint.md
48
51
 
49
- - type: inline
50
- content: |
51
- ### Step 4: Pre-flight Checks
52
- - No blocking checks required.
52
+ - type: shared
53
+ source: sections/output-format-constraint.md
53
54
 
54
55
  - type: file
55
56
  source: ./business.md
@@ -86,7 +87,8 @@ sections:
86
87
  ### Removed entry: `{id}`
87
88
  - File: `.ai-agents/knowledge/{path}` (deleted)
88
89
  - References dropped from:
89
- - `registry.yaml > knowledge.shared` (if applicable)
90
+ - `registry.yaml > knowledge._all` (if applicable)
91
+ - `registry.yaml > knowledge.{projectName}` (if applicable)
90
92
  - `registry.yaml > skills.{name}.knowledge` x N (if applicable)
91
93
  - `core/manifest.yaml > files[]` (if applicable)
92
94
  ```
@@ -15,7 +15,7 @@ If no analysis or design artifacts exist and the user provides no description, p
15
15
  If `active_change.plan_path is non-empty` AND `.ai-agents/workspace/artifacts/{active_change.id}/plan.yaml` already exists:
16
16
 
17
17
  - Read the existing plan.
18
- - Show a summary (task count, status counts, current_task).
18
+ - Show a summary (task count, status counts, current_tasks).
19
19
  - Ask: "A plan already exists. Choose: (1) regenerate from scratch (existing tasks discarded), (2) cancel and use `/mvt-update-plan` to evolve it, (3) abort."
20
20
  - Only continue with generation on choice (1).
21
21
 
@@ -31,6 +31,7 @@ Decompose the change with the following constraints. These constraints are AI-fr
31
31
  | Explicit dependencies | If task B requires output from task A, list `A` in B's `depends_on`. Avoid hidden ordering. Tasks that can run in parallel should have no dependency between them. |
32
32
  | No cycles | Dependency graph must be a DAG. Validation will reject cycles. |
33
33
  | Skill hint | Set `skill_hint` to the skill best suited to execute the task (without `/` prefix): `mvt-implement`, `mvt-test`, `mvt-fix`, `mvt-design`, `mvt-review`, `mvt-refactor`, etc. |
34
+ | Project attribution | Each task must have a `project` array listing which projects it belongs to. In a single-project workspace (`projects.length == 1`), set `project: ["default"]` (or the sole project's name). In a multi-project workspace, auto-infer from the task's file paths matching `projects[].path` and `projects[].source_paths`; if ambiguous, prompt the user. Cross-project tasks list multiple project names. |
34
35
 
35
36
  ### Step 4: Assemble plan.yaml
36
37
 
@@ -43,7 +44,8 @@ title: "Feature Name"
43
44
  created_at: "2026-05-31T11:30:00"
44
45
  updated_at: "2026-05-31T11:30:00"
45
46
  status: in_progress
46
- current_task: "t1-foundation-layer"
47
+ current_tasks:
48
+ default: "t1-foundation-layer"
47
49
 
48
50
  tasks:
49
51
  - id: "t1-foundation-layer"
@@ -51,6 +53,8 @@ tasks:
51
53
  status: in_progress
52
54
  completed_at: null
53
55
  depends_on: []
56
+ project:
57
+ - default
54
58
  skill_hint: mvt-implement
55
59
  artifacts:
56
60
  files:
@@ -68,6 +72,8 @@ tasks:
68
72
  status: pending
69
73
  completed_at: null
70
74
  depends_on: ["t1-foundation-layer"]
75
+ project:
76
+ - default
71
77
  skill_hint: mvt-implement
72
78
  artifacts: null
73
79
  notes: >
@@ -87,7 +93,7 @@ tasks:
87
93
  - `created_at`: current ISO 8601 timestamp
88
94
  - `updated_at`: same as `created_at` initially
89
95
  - `status: in_progress`
90
- - `current_task`: the `id` of the first executable task (a task with `depends_on: []`), set to `in_progress`
96
+ - `current_tasks`: a map of project name to task id. For single-project workspaces: `{ default: "<first_task_id>" }`. For multi-project: one key per project, each pointing to that project's first executable task.
91
97
 
92
98
  #### Task fields
93
99
 
@@ -98,6 +104,7 @@ For each task, populate:
98
104
  - **`status`**: first executable task → `in_progress`; all others → `pending`.
99
105
  - **`completed_at`**: `null` for all tasks on initial creation (set by `/mvt-update-plan` when marking `done`).
100
106
  - **`depends_on`**: array of task ids. Empty array `[]` means no dependencies.
107
+ - **`project`**: array of project names this task belongs to. In single-project workspaces, use `["default"]` (or the sole project's name). Cross-project tasks list multiple names. Auto-infer from file paths matching `projects[].path` and `projects[].source_paths`; if ambiguous, prompt the user.
101
108
  - **`skill_hint`**: the skill name (without `/`) that will execute this task.
102
109
  - **`artifacts`**: structured object. On initial plan creation, set to `null` or pre-populate with planned target files if known:
103
110
  ```yaml
@@ -118,11 +125,12 @@ Before writing, validate the assembled YAML:
118
125
 
119
126
  1. **Unique IDs** — no two tasks share the same `id`
120
127
  2. **Valid references** — every `depends_on` entry references an existing task `id`
121
- 3. **No cycles** — the dependency graph is a DAG
122
- 4. **current_task validity** — references a task with status `pending` or `in_progress`
128
+ 3. **No cycles** — the dependency graph is a DAG (per-project subgraph when multi-project)
129
+ 4. **current_tasks validity** — each value references a task with status `pending` or `in_progress`
123
130
  5. **Acceptance required** — every task has at least one acceptance criterion
124
- 6. **Single in_progress** — at most one task has status `in_progress`
131
+ 6. **Per-project in_progress** — at most one `in_progress` task per project (not globally)
125
132
  7. **completed_at consistency** — must be `null` for all non-done tasks
133
+ 8. **Project attribution** — every task has a `project` array with at least one valid project name
126
134
 
127
135
  If validation fails, revise the plan and re-validate (do NOT write a broken plan).
128
136
 
@@ -148,9 +156,9 @@ Render an inline summary (no external template). Structure:
148
156
 
149
157
  ### Task Breakdown
150
158
 
151
- | # | id | title | status | skill | depends_on |
152
- |---|----|----|--------|-------|------------|
153
- | 1 | {id} | {title} | {status} | {skill_hint} | {deps_or_"—"} |
159
+ | # | id | title | status | skill | project | depends_on |
160
+ |---|----|----|--------|-------|---------|------------|
161
+ | 1 | {id} | {title} | {status} | {skill_hint} | {project_list} | {deps_or_"—"} |
154
162
  | ... |
155
163
 
156
164
  ```
@@ -48,6 +48,9 @@ sections:
48
48
  - type: shared
49
49
  source: sections/output-language-constraint.md
50
50
 
51
+ - type: shared
52
+ source: sections/output-format-constraint.md
53
+
51
54
  - type: shared
52
55
  source: sections/activation-preflight.md
53
56
  params:
@@ -46,7 +46,22 @@
46
46
  5. Cross-reference `project-context.md` layer rules (if available) -- flag any change that would violate layer constraints.
47
47
  - **Output of this step**: a target list (`path | action | one-line intent`).
48
48
 
49
- ### Step 4: Plan the Change
49
+ ### Step 4: Identify Project Scope and Load Project-Specific Knowledge
50
+
51
+ This step applies only when the workspace has multiple projects (`projects.length > 1` in `project-context.yaml`). In single-project workspaces, all relevant knowledge was loaded at activation; skip this step entirely.
52
+
53
+ - **Project identification**: match the file paths resolved in Step 3 against `projects[].path` and `projects[].source_paths`:
54
+ - A file whose path starts with a project's `path` prefix belongs to that project.
55
+ - A file under a project's `source_paths` entry also belongs to that project.
56
+ - Collect the set of unique project names from all matched files. This is the **active project scope** for this invocation.
57
+ - **On-demand knowledge loading**: for each project P in the active project scope, read `.ai-agents/registry.yaml` and load:
58
+ 1. Every entry under `knowledge.{P}` -- load each entry's referenced files (resolve relative to `.ai-agents/{source}`).
59
+ 2. Every entry under `skills.mvt-quick-dev.knowledge.{P}` -- load each entry's referenced files.
60
+ 3. Skip any key absent from the registry (no project-specific knowledge is valid; do not warn).
61
+ - **Multi-project scenario**: if files span multiple projects, load each project's knowledge sequentially. The skill operates with the union of all loaded project-specific knowledge plus the `_all` knowledge already loaded at activation.
62
+ - **Unmatched files**: if a file path does not match any project's `path` or `source_paths`, surface a note and treat it as belonging to the first project in `projects[]` (fallback). This may indicate a configuration gap in `project-context.yaml`.
63
+
64
+ ### Step 5: Plan the Change
50
65
  - **What**: produce an ordered file list before writing any code.
51
66
  - **How**:
52
67
  1. For each target from Step 3, decide: `create | modify | delete`, and write a one-line intent.
@@ -60,31 +75,31 @@
60
75
  | Plan exceeds 3 files | Escalate to Complex -- STOP, recommend standard workflow |
61
76
  | Plan introduces an unplanned module | Escalate to Complex -- STOP, recommend standard workflow |
62
77
 
63
- ### Step 5: Implement
78
+ ### Step 6: Implement
64
79
  - **What**: write/modify the planned files.
65
80
  - **How**:
66
- 1. Apply changes one file at a time, in the order determined by Step 4.
67
- 2. Follow `coding-standards.md` if available; match surrounding code style otherwise.
81
+ 1. Apply changes one file at a time, in the order determined by Step 5.
82
+ 2. Follow the coding standards loaded by activation (if any); match surrounding code style otherwise.
68
83
  3. Respect module/layer rules from `project-context.md`. Forbidden imports must NOT appear.
69
84
  4. Add error handling at system boundaries only (HTTP, DB, external API, file IO, message bus). Do NOT add try/catch around internal calls.
70
85
  5. Inline comments only for non-obvious algorithmic choices or deliberate workarounds with a reason.
71
86
  6. Do NOT introduce abstractions, helpers, or feature flags beyond what the task requires.
72
87
 
73
- ### Step 6: Quick Verify
88
+ ### Step 7: Quick Verify
74
89
  - **What**: light-weight verification before reporting completion.
75
90
  - **How**:
76
91
  1. If a type-checker is configured for the project (`tsc`, `mypy`, `cargo check`, etc.), run it on changed files only. Surface failures.
77
92
  2. If existing tests cover the changed code, suggest the test command but do not auto-run unless user explicitly approved.
78
93
  3. For frontend/UI changes, note that user should verify in browser; do NOT claim "tested" based on type-check alone.
79
94
 
80
- ### Step 7: Summarize in Conversation
95
+ ### Step 8: Summarize in Conversation
81
96
  - **What**: present the result without writing any artifact file.
82
97
  - **How**: output a brief summary containing:
83
98
  - Files touched: `path | action`
84
99
  - Verification status: type-check result, test suggestion
85
100
  - **No artifact is written. No document is generated.** This is a conversation-only skill.
86
101
 
87
- ### Step 8: State Update
102
+ ### Step 9: State Update
88
103
  Apply the State Update rules defined in the **State Update** section below.
89
104
 
90
105
  ## Edge Cases & Errors
@@ -39,7 +39,6 @@ sections:
39
39
  params:
40
40
  extended_context:
41
41
  - ".ai-agents/knowledge/project/_generated/project-context.md -- Module/layer map (optional)"
42
- - ".ai-agents/knowledge/principle/coding-standards.md -- Coding standards (optional)"
43
42
  - "Target source files (load based on change description)"
44
43
 
45
44
  - type: shared
@@ -48,6 +47,9 @@ sections:
48
47
  - type: shared
49
48
  source: sections/output-language-constraint.md
50
49
 
50
+ - type: shared
51
+ source: sections/output-format-constraint.md
52
+
51
53
  - type: inline
52
54
  content: |
53
55
  ## Operation Mode: Shortcut