semantu-agents 1.3.0 → 1.4.0

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.
package/README.md CHANGED
@@ -23,33 +23,45 @@ For normal users, rerun:
23
23
  npx semantu-agents global
24
24
  ```
25
25
 
26
- For contributors with an editable checkout at `~/.agents-src`, run this from anywhere:
26
+ For contributors with a registered editable checkout, run this from anywhere:
27
27
 
28
28
  ```bash
29
29
  npx semantu-agents update
30
30
  ```
31
31
 
32
- This updates `~/.agents-src/main`, syncs it to `~/.claude/skills` and `~/.agents/skills`, then restores your previous branch when possible. If `~/.agents-src` has uncommitted changes, commit or stash them first.
32
+ This updates the registered checkout's `main` branch, repairs its global skill links, then restores your previous branch when possible. If the checkout has uncommitted changes, commit or stash them first.
33
+
34
+ `update` requires a named Git branch. It refuses dirty checkouts and detached HEAD states.
33
35
 
34
36
  ## Contributing Skill Changes
35
37
 
36
- Install an editable source checkout:
38
+ Register an existing editable checkout:
37
39
 
38
40
  ```bash
41
+ cd /path/to/semantu-agents
39
42
  npx semantu-agents dev
40
43
  ```
41
44
 
42
- This clones or pulls `github.com:Semantu/agents` into `~/.agents-src`, installs a post-merge hook, and syncs that checkout globally.
45
+ You can also provide the checkout explicitly:
46
+
47
+ ```bash
48
+ npx semantu-agents dev /path/to/semantu-agents
49
+ ```
50
+
51
+ Without a path, `dev` uses the current directory when it is the agents checkout, then a previously registered checkout, then `~/packages/semantu-agents`. It never clones another checkout.
52
+
53
+ The resolved path is stored in `~/.config/semantu-agents/config.json`. Each package-managed skill in `~/.claude/skills` and `~/.agents/skills` is linked to that checkout, so edits are available globally immediately. Unrelated installed skills are preserved.
54
+
55
+ Directory junctions are used on Windows; directory symlinks are used elsewhere.
43
56
 
44
- Dev mode requires repo access. If cloning fails, ask for access to the Semantu agents repo.
57
+ Dev mode requires an existing checkout. Clone the repository separately first if needed.
45
58
 
46
59
  Make changes in the source checkout only:
47
60
 
48
61
  ```bash
49
- cd ~/.agents-src
62
+ cd /path/to/semantu-agents
50
63
  git checkout -b my-change
51
64
  # edit skills/public/... or skills/private/...
52
- npm run sync
53
65
  git add .
54
66
  git commit -m "improve workflow skill"
55
67
  git push -u origin my-change
@@ -61,9 +73,9 @@ Do not edit these generated folders directly:
61
73
  - `~/.claude/skills`
62
74
  - `~/.agents/skills`
63
75
 
64
- They are overwritten by `semantu-agents global`, `semantu-agents sync`, and `semantu-agents update`.
76
+ In normal global mode, package-managed skills are copied from npm. In development mode, they are links managed by `dev`, `sync`, and `update`; edit the registered checkout instead.
65
77
 
66
- The dev post-merge hook runs `node cli.mjs sync` after pulls, so merged changes are synced globally automatically.
78
+ Running `semantu-agents global` exits development mode and clears the registered checkout. Run `dev [path]` again to restore live links.
67
79
 
68
80
  ## Project Setup
69
81
 
package/cli.mjs CHANGED
@@ -1,10 +1,11 @@
1
1
  #!/usr/bin/env node
2
2
 
3
3
  import {execSync} from 'node:child_process';
4
- import {cpSync, existsSync, mkdirSync, readFileSync, readdirSync, rmSync, statSync, writeFileSync} from 'node:fs';
4
+ import {cpSync, existsSync, mkdirSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, symlinkSync, writeFileSync} from 'node:fs';
5
5
  import {homedir} from 'node:os';
6
6
  import path from 'node:path';
7
7
  import {fileURLToPath} from 'node:url';
8
+ import {directoryLinkType} from './lib/link-type.mjs';
8
9
 
9
10
  const __dirname = path.dirname(fileURLToPath(import.meta.url));
10
11
  const args = process.argv.slice(2);
@@ -38,15 +39,6 @@ function cloneOrPull(dir) {
38
39
  }
39
40
  }
40
41
 
41
- function cloneIfMissing(dir) {
42
- if (existsSync(path.join(dir, '.git'))) {
43
- console.log('Using existing editable agents repo at ~/.agents-src');
44
- } else {
45
- console.log('Cloning agents repo...');
46
- run(`git clone ${skillsRepo} ${dir}`);
47
- }
48
- }
49
-
50
42
  function globalTargets() {
51
43
  const home = homedir();
52
44
  return [
@@ -55,93 +47,155 @@ function globalTargets() {
55
47
  ];
56
48
  }
57
49
 
58
- function syncSkillsInto(skillsSource, targets) {
59
- if (!existsSync(skillsSource)) return;
50
+ function skillSources(sourceDir, includePrivate) {
51
+ const sources = new Map();
52
+ const roots = [path.join(sourceDir, 'skills', 'public')];
53
+ if (includePrivate) roots.push(path.join(sourceDir, 'skills', 'private'));
60
54
 
61
- for (const dest of targets) {
62
- mkdirSync(dest, {recursive: true});
63
- cpSync(skillsSource, dest, {recursive: true});
55
+ for (const root of roots) {
56
+ if (!existsSync(root)) continue;
57
+ for (const name of readdirSync(root)) {
58
+ const source = path.join(root, name);
59
+ if (statSync(source).isDirectory()) sources.set(name, source);
60
+ }
64
61
  }
62
+
63
+ return sources;
65
64
  }
66
65
 
67
- function syncFromSource(sourceDir, label = 'source checkout', options = {}) {
66
+ function installSkillsFromSource(sourceDir, label, options = {}) {
68
67
  const includePrivate = options.includePrivate ?? true;
68
+ const mode = options.mode ?? 'copy';
69
69
  const targets = globalTargets();
70
- const publicSkills = path.join(sourceDir, 'skills', 'public');
71
- const privateSkills = path.join(sourceDir, 'skills', 'private');
70
+ const sources = skillSources(sourceDir, includePrivate);
72
71
 
73
72
  for (const dest of targets) {
74
- rmSync(dest, {recursive: true, force: true});
73
+ mkdirSync(dest, {recursive: true});
74
+ for (const [name, source] of sources) {
75
+ // Replace only skills managed by this package; preserve every other entry in the global directory.
76
+ const target = path.join(dest, name);
77
+ rmSync(target, {recursive: true, force: true});
78
+ if (mode === 'link') {
79
+ symlinkSync(source, target, directoryLinkType(process.platform));
80
+ } else {
81
+ cpSync(source, target, {recursive: true});
82
+ }
83
+ }
75
84
  }
76
85
 
77
- syncSkillsInto(publicSkills, targets);
78
- if (includePrivate) {
79
- syncSkillsInto(privateSkills, targets);
86
+ console.log(`${mode === 'link' ? 'Linked' : 'Synced'} skills from ${label} -> ~/.claude/skills/ and ~/.agents/skills/`);
87
+ }
88
+
89
+ function devConfigPath() {
90
+ return path.join(homedir(), '.config', 'semantu-agents', 'config.json');
91
+ }
92
+
93
+ function readDevConfig() {
94
+ const configPath = devConfigPath();
95
+ if (!existsSync(configPath)) return null;
96
+ try {
97
+ return JSON.parse(readFileSync(configPath, 'utf8'));
98
+ } catch {
99
+ console.error(`Invalid development configuration: ${configPath}`);
100
+ console.error('Rerun `npx semantu-agents dev [path]` after removing or repairing this file.');
101
+ process.exit(1);
80
102
  }
103
+ }
81
104
 
82
- console.log(`Synced skills from ${label} -> ~/.claude/skills/ and ~/.agents/skills/`);
105
+ function writeDevConfig(source) {
106
+ const configPath = devConfigPath();
107
+ mkdirSync(path.dirname(configPath), {recursive: true});
108
+ writeFileSync(configPath, `${JSON.stringify({source}, null, 2)}\n`);
83
109
  }
84
110
 
85
- function setupGlobal() {
86
- syncFromSource(__dirname, 'npm package', {includePrivate: false});
87
- console.log('\nDone. Public skills synced globally. Run `npx semantu-agents dev` to install an editable source checkout.');
111
+ function clearDevConfig() {
112
+ rmSync(devConfigPath(), {force: true});
88
113
  }
89
114
 
90
- function installPostMergeHook(repoDir) {
91
- const hooksDir = path.join(repoDir, '.git', 'hooks');
92
- const hookPath = path.join(hooksDir, 'post-merge');
93
- const hook = `#!/bin/sh
94
- [ "$SEMANTU_AGENTS_SKIP_HOOK_SYNC" = "1" ] && exit 0
95
- cd "$(git rev-parse --show-toplevel)" && node cli.mjs sync
96
- `;
97
-
98
- mkdirSync(hooksDir, {recursive: true});
99
- writeFileSync(hookPath, hook, {mode: 0o755});
100
- console.log('Installed post-merge hook to sync global skills after pulls');
115
+ function isAgentsCheckout(candidate) {
116
+ try {
117
+ const packageJson = JSON.parse(readFileSync(path.join(candidate, 'package.json'), 'utf8'));
118
+ return packageJson.name === 'semantu-agents' &&
119
+ existsSync(path.join(candidate, '.git')) &&
120
+ existsSync(path.join(candidate, 'skills', 'public'));
121
+ } catch {
122
+ return false;
123
+ }
101
124
  }
102
125
 
103
- function setupDev() {
104
- const srcDir = path.join(homedir(), '.agents-src');
126
+ function resolveDevSource(inputPath) {
127
+ if (inputPath) {
128
+ const resolved = path.resolve(inputPath);
129
+ if (isAgentsCheckout(resolved)) return realpathSync(resolved);
130
+ console.error(`Not an editable semantu-agents checkout: ${resolved}`);
131
+ process.exit(1);
132
+ }
133
+
134
+ const configured = readDevConfig()?.source;
135
+ const candidates = [
136
+ process.cwd(),
137
+ configured,
138
+ path.join(homedir(), 'packages', 'semantu-agents'),
139
+ ].filter(Boolean);
140
+
141
+ for (const candidate of candidates) {
142
+ const resolved = path.resolve(candidate);
143
+ if (isAgentsCheckout(resolved)) return realpathSync(resolved);
144
+ }
145
+
146
+ console.error('No editable semantu-agents checkout found.');
147
+ console.error('Run `npx semantu-agents dev /path/to/checkout` from an existing checkout.');
148
+ process.exit(1);
149
+ }
105
150
 
106
- cloneIfMissing(srcDir);
107
- installPostMergeHook(srcDir);
108
- syncFromSource(srcDir, '~/.agents-src');
151
+ function setupGlobal() {
152
+ installSkillsFromSource(__dirname, 'npm package', {includePrivate: false});
153
+ clearDevConfig();
154
+ console.log('\nDone. Public skills synced globally. Run `npx semantu-agents dev [path]` to link an editable checkout.');
155
+ }
109
156
 
110
- console.log('\nDone. Edit skills in ~/.agents-src, run `node cli.mjs sync`, then commit and open a PR.');
157
+ function setupDev(inputPath) {
158
+ const source = resolveDevSource(inputPath);
159
+ writeDevConfig(source);
160
+ installSkillsFromSource(source, source, {mode: 'link'});
161
+ console.log(`\nDone. Edit skills in ${source}; changes are available globally immediately.`);
111
162
  }
112
163
 
113
164
  function syncGlobalFromCurrentCheckout() {
114
- syncFromSource(__dirname, 'current checkout');
165
+ setupDev(__dirname);
115
166
  }
116
167
 
117
168
  function updateDevCheckout() {
118
- const srcDir = path.join(homedir(), '.agents-src');
119
-
120
- if (!existsSync(path.join(srcDir, '.git'))) {
121
- console.log('No editable checkout found at ~/.agents-src.');
122
- console.log('Run `npx semantu-agents dev` if you have access to github.com:Semantu/agents.');
169
+ const source = readDevConfig()?.source;
170
+ if (!source || !isAgentsCheckout(source)) {
171
+ console.log('No registered editable checkout found.');
172
+ console.log('Run `npx semantu-agents dev [path]` from an existing checkout.');
123
173
  process.exit(1);
124
174
  }
125
175
 
126
- const currentBranch = output('git branch --show-current', {cwd: srcDir});
127
- const dirty = output('git status --porcelain', {cwd: srcDir});
176
+ const currentBranch = output('git branch --show-current', {cwd: source});
177
+ if (!currentBranch) {
178
+ console.log(`Cannot update ${source} from a detached HEAD.`);
179
+ console.log('Switch to a named branch, then rerun `npx semantu-agents update`.');
180
+ process.exit(1);
181
+ }
182
+ const dirty = output('git status --porcelain', {cwd: source});
128
183
 
129
184
  if (dirty) {
130
- console.log('Cannot update ~/.agents-src because it has uncommitted changes.');
185
+ console.log(`Cannot update ${source} because it has uncommitted changes.`);
131
186
  console.log('Commit, stash, or discard them, then rerun `npx semantu-agents update`.');
132
187
  process.exit(1);
133
188
  }
134
189
 
135
- run('git fetch origin main', {cwd: srcDir});
136
- run('git switch main', {cwd: srcDir});
137
- run('git pull --ff-only origin main', {
138
- cwd: srcDir,
139
- env: {...process.env, SEMANTU_AGENTS_SKIP_HOOK_SYNC: '1'},
140
- });
141
- syncFromSource(srcDir, '~/.agents-src');
142
-
143
- if (currentBranch && currentBranch !== 'main') {
144
- run(`git switch ${currentBranch}`, {cwd: srcDir});
190
+ run('git fetch origin main', {cwd: source});
191
+ try {
192
+ if (currentBranch !== 'main') run('git switch main', {cwd: source});
193
+ run('git pull --ff-only origin main', {cwd: source});
194
+ installSkillsFromSource(source, source, {mode: 'link'});
195
+ } finally {
196
+ if (currentBranch && currentBranch !== 'main') {
197
+ run(`git switch ${currentBranch}`, {cwd: source});
198
+ }
145
199
  }
146
200
  }
147
201
 
@@ -403,7 +457,7 @@ if (command === 'docs') {
403
457
  } else if (command === 'global' || isGlobal) {
404
458
  setupGlobal();
405
459
  } else if (command === 'dev') {
406
- setupDev();
460
+ setupDev(args[1]);
407
461
  } else if (command === 'sync') {
408
462
  syncGlobalFromCurrentCheckout();
409
463
  } else if (command === 'update') {
@@ -0,0 +1,3 @@
1
+ export function directoryLinkType(platform) {
2
+ return platform === 'win32' ? 'junction' : 'dir';
3
+ }
package/package.json CHANGED
@@ -1,22 +1,25 @@
1
1
  {
2
2
  "name": "semantu-agents",
3
- "version": "1.3.0",
3
+ "version": "1.4.0",
4
4
  "description": "Reusable Claude Code skills and hooks for Semantu projects",
5
5
  "type": "module",
6
6
  "bin": "cli.mjs",
7
7
  "files": [
8
8
  "cli.mjs",
9
+ "lib",
9
10
  "skills/public"
10
11
  ],
11
12
  "scripts": {
12
- "sync": "node cli.mjs sync"
13
+ "sync": "node cli.mjs sync",
14
+ "test": "node --test test/*.test.mjs"
13
15
  },
14
16
  "publishConfig": {
15
17
  "access": "public"
16
18
  },
17
19
  "devDependencies": {
18
20
  "@changesets/changelog-github": "^0.5.2",
19
- "@changesets/cli": "^2.29.8"
21
+ "@changesets/cli": "^2.29.8",
22
+ "js-yaml": "^4.3.2"
20
23
  },
21
24
  "dependencies": {
22
25
  "gray-matter": "^4.0.3"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: automatic
3
- description: Execute the full workflow cycle (ideation -> plan -> tasks -> implementation -> review) without waiting for user confirmation between modes. Use only when the user explicitly requests automatic mode. Never auto-suggest or auto-enter this mode. Pause after review and ask whether to continue with wrapup or iterate.
3
+ description: Execute the full workflow cycle and automatically iterate on review findings of medium severity or higher. Use only when the user explicitly requests automatic mode. Never auto-suggest or auto-enter this mode.
4
4
  ---
5
5
 
6
6
  # Instructions
@@ -21,7 +21,7 @@ Run the standard workflow end-to-end without waiting for user confirmation betwe
21
21
  4. `implementation`
22
22
  5. `review`
23
23
 
24
- Then pause.
24
+ Automatically iterate on review findings until only low/minor gaps remain, then pause.
25
25
 
26
26
  ## Core behavior
27
27
 
@@ -34,9 +34,7 @@ Then pause.
34
34
  For each decision, show the reasoning and chosen option in chat, then record it in the active plan doc just as in interactive mode.
35
35
  4. **Progress indicators**: When walking through decisions or gaps, always show position — e.g. "Decision 2 of 5" — so the user can gauge progress when reviewing.
36
36
  5. After ideation is complete, continue immediately into plan mode, then tasks mode, then implementation mode, then review mode.
37
- 6. Pause after review and ask the user to choose exactly one:
38
- - `wrapup`
39
- - `iterate` — select which gaps to address
37
+ 6. After review, automatically iterate on every medium-or-higher gap, including stale comments and documentation. Leave low/minor gaps for the final review pause.
40
38
 
41
39
  ## Mandatory transition gates
42
40
 
@@ -83,9 +81,9 @@ Follow numbering and conversion rules from workflow mode.
83
81
 
84
82
  ## Iterate loop
85
83
 
86
- If the user chooses `iterate` after review:
84
+ After each review:
87
85
 
88
- 1. Ask the user which review-identified gaps to address now and which to defer.
86
+ 1. Classify findings as critical/urgent, high, medium, or low/minor. Select every medium-or-higher gap, plus stale comments and documentation.
89
87
  2. **All iteration work stays in the active plan document.** Do not create additional plan docs for iteration gaps.
90
88
  3. Append the following sections to the plan doc:
91
89
 
@@ -113,11 +111,8 @@ If the user chooses `iterate` after review:
113
111
  ```
114
112
 
115
113
  4. Walk through ideation for **all selected gaps first** (in chat batches where possible, emulating user responses with the same priority framework), then condense into a plan, then break into phases/tasks, then implement all phases.
116
- 5. After implementation, run review again. Pause and ask:
117
- - `wrapup`
118
- - `iterate`
119
-
120
- Repeat until the user selects `wrapup` or stops.
114
+ 5. After implementation, run review again and repeat while selected gaps remain.
115
+ 6. When only low/minor gaps remain, pause and ask whether to `wrapup` or address any remaining gap.
121
116
 
122
117
  ## Handoff to wrapup
123
118
 
@@ -135,5 +130,5 @@ Enter `wrapup` only after the user explicitly chooses `wrapup` at a review pause
135
130
 
136
131
  ## Exit criteria
137
132
 
138
- - Reached review mode and paused with explicit `wrapup` vs `iterate` question, or
133
+ - Completed review iterations until only low/minor gaps remain and paused, or
139
134
  - User explicitly selected `wrapup` and control has been handed off to wrapup mode.
@@ -18,16 +18,17 @@ Run this skill when the user explicitly says `explore <topic>`, clearly asks to
18
18
  1. Confirm scope only if the topic is ambiguous; otherwise proceed directly.
19
19
  2. Decompose the topic into decision candidates and unknowns.
20
20
  3. Prioritize planning blockers first when called from ideation or review iteration.
21
- 4. For each decision, give concise context and assumptions, then provide exactly 3 viable approaches (A-C).
22
- 5. For each approach, list pros, cons, and risks.
23
- 6. Recommend one approach (A/B/C) with a one-line rationale.
24
- 7. If there are multiple decisions, present them in batches of 3 by default (use fewer only when fewer remain or when the user asks for a different batch size). Start with `Decision x-y of N`, and end with `Recap: 1A 2C 3B`; ask for agreement or edits.
21
+ 4. Before presenting options, explain the affected area, current behavior, wider context, and why the decision matters. Assume the user may not know the implementation. Include code, before/after, or concrete examples when useful.
22
+ 5. Present exactly 3 viable approaches (A–C), each with pros, cons, and risks. Mark the suggested option in its heading with **(Recommended)**.
23
+ 6. Immediately after that decision's options, add a separate **Recommendation** section naming the suggested option and why it is the best fit. Do this before presenting the next decision; never collect recommendations at the end of a batch.
24
+ 7. If there are multiple decisions, present them in batches of 3 by default (use fewer only when fewer remain or when the user asks for a different batch size). Start with `Decision x-y of N`, and end with `Recap: 1A 2C 3B`; ask for agreement or edits in normal chat.
25
25
  8. Iterate until consent; no feedback on a decision counts as acceptance after an explicit agreement prompt.
26
26
  9. Recurse only for nested decisions that block planning. Default max depth is 2 unless the user asks for deeper drilldown.
27
- 10. After consent, ask whether to continue the current mode or switch modes.
27
+ 10. After consent, ask whether to continue the current mode or switch modes in normal chat.
28
28
 
29
29
  ## Guardrails
30
30
 
31
+ - Do not use interactive question tools such as `AskUserQuestion`, `request_user_input`, picker UIs, or multiple-choice tool prompts. They interrupt reading the proposals. Ask follow-up questions as ordinary chat text.
31
32
  - Do not force a mode switch by default; this skill can run inside any active mode.
32
33
  - Do not create ideation/plan artifacts unless the active mode requires them or the user asks.
33
34
  - When called from ideation, explore in chat first and let ideation persist only accepted decisions.
@@ -17,7 +17,7 @@ Run only after explicit user confirmation to enter implementation mode, with an
17
17
  4. Before completing a phase, compare changed behavior/API/contracts against the plan's Architecture compliance section.
18
18
  5. Run the phase validation criteria and record results, including the quick regression gate for impacted packages (target total runtime 1-2 minutes).
19
19
  6. After a phase is completed, update `docs/plans/<nnn>-<topic>.md` to reflect completed work and mark phase status. This update is mandatory before moving to the next phase.
20
- 7. Create one commit per phase, including code changes and the phase-completion plan update in the same commit.
20
+ 7. Create one commit per phase per repository. Never combine parent and nested repository changes. For reusable packages, keep root-project-specific names out of commit messages. Include code changes and the phase-completion plan update in the same commit.
21
21
  8. Continue to next phase without pausing only if there are no deviations and no major problems.
22
22
  9. If any deviation/blocker/major risk appears, pause and report.
23
23
 
@@ -43,7 +43,7 @@ When the plan marks phases as parallelizable, use the Task tool (or any availabl
43
43
 
44
44
  ## Documentation
45
45
 
46
- - Update `docs/reports` when pausing for deviations/problems.
46
+ - Record deviations and problems in the active plan. Never update historical reports.
47
47
 
48
48
  ## Guardrails
49
49
 
@@ -14,11 +14,17 @@ Run only when the user explicitly confirms review mode.
14
14
  1. Set or update the active plan frontmatter status to `Review`.
15
15
  2. Compare current implementation against the original intent and agreed plan.
16
16
  3. Assess whether the result is ready for others to use.
17
- 4. Identify what is still missing to make this work more complete.
18
- 5. Identify gaps or risks in the current implementation.
19
- 6. Identify likely future work required for fuller completeness.
20
- 7. Re-run deferred full/slow test suites for all impacted repos/packages from the plan's test strategy, and report pass/fail with any skipped checks and reasons.
21
- 8. Audit architecture compliance:
17
+ 4. Spend independent attention on each review pass below. Do not collapse these into a single generic gap scan:
18
+ - **Intent and plan fit**: What was promised, what exists, and what diverged.
19
+ - **Remaining functional gaps**: Missing behavior, incomplete flows, unhandled edge cases, or acceptance criteria that are only partially met.
20
+ - **Weaknesses and issues**: Bugs, brittle assumptions, confusing UX/API behavior, failure modes, data integrity risks, security/privacy concerns, performance risks, and operational risks.
21
+ - **Cleanup needed**: Dead code, unused files, stale scaffolding, naming drift, duplication, unnecessary TODOs, and generated artifacts that should not remain.
22
+ - **Simplification opportunities**: Overbuilt abstractions, needless configuration, avoidable branching, complicated contracts, or places where less code would be clearer.
23
+ - **Comments needed**: Non-obvious intent, invariants, boundary conditions, or algorithms that need concise explanatory comments.
24
+ - **Documentation updates**: README, setup instructions, examples, architecture docs, API docs, env/config notes, changelogs, reports, or plan docs that need to reflect the work.
25
+ - **Tests and validation**: Missing coverage, weak assertions, manual QA still needed, deferred suites to rerun, and any checks that should be added before external use.
26
+ 5. Re-run deferred full/slow test suites for all impacted repos/packages from the plan's test strategy, and report pass/fail with any skipped checks and reasons.
27
+ 6. Audit architecture compliance:
22
28
  - Run `npx semantu-agents docs architecture`.
23
29
  - Re-read the architecture docs cited by the plan.
24
30
  - Compare changed code, behavior, APIs, and contracts against those docs.
@@ -28,26 +34,46 @@ Run only when the user explicitly confirms review mode.
28
34
 
29
35
  When the implementation spans multiple modules or many files, spawn subagents to review different areas concurrently. For example: one agent reviews API surface correctness, another checks test coverage against the plan, another checks for dead code or missing error handling.
30
36
 
31
- Each review subagent receives: the relevant plan section, the list of files in its review area, and the specific review questions to answer. Subagents report findings; the main agent synthesizes results into the gap list presented to the user.
37
+ Each review subagent receives: the relevant plan section, the list of files in its review area, and the specific review questions to answer. Subagents report findings; the main agent synthesizes results into the review sections presented to the user.
32
38
 
33
39
  ## Output
34
40
 
35
41
  Review findings must be emitted in chat first.
36
42
  Do not write findings to plan or report files until decisions are clarified with the user.
37
43
 
38
- Present each gap with a **progress indicator** — e.g. "Gap 1 of 4" — so the user knows how many remain.
44
+ Use these sections in the review output. Each section must either list findings or explicitly say `No findings`.
39
45
 
40
- ## Gap triage
46
+ ```markdown
47
+ ## Intent and Plan Fit
48
+ ## Remaining Functional Gaps
49
+ ## Weaknesses / Issues
50
+ ## Cleanup Needed
51
+ ## Simplification Opportunities
52
+ ## Comments Needed
53
+ ## Documentation Updates
54
+ ## Tests / Validation
55
+ ## Architecture Compliance
56
+ ## Proposed Fixes and Improvements
57
+ ## Proposed Deferrals
58
+ ```
59
+
60
+ Present each actionable finding with a **progress indicator** — e.g. "Finding 1 of 7" — so the user knows how many remain.
41
61
 
42
- After presenting all gaps, ask the user:
62
+ At the end of the review, the agent must independently propose:
63
+ - **Proposed Fixes and Improvements**: A prioritized list of things that should be fixed, improved, cleaned up, simplified, documented, commented, or validated before wrapup. This list is based on the whole review, not only direct plan misses.
64
+ - **Proposed Deferrals**: A separate list of work that can genuinely wait because it belongs to a later phase of the active plan, another plan, or a future todo/backlog item. For each deferral, state why it is not part of the current completion bar.
43
65
 
44
- > "Which of these gaps do you want to address now, and which should we defer?"
66
+ ## Finding triage
45
67
 
46
- For gaps the user wants to **address now** (iterate):
68
+ After presenting all findings and the proposed fix/defer lists, ask the user:
69
+
70
+ > "Which proposed fixes/improvements should we address now, which should we defer, and which risks do you accept as-is?"
71
+
72
+ For findings the user wants to **address now** (iterate):
47
73
  - These will go through a full ideation → plan → tasks → implementation cycle.
48
74
  - All iteration work stays in the active plan document (see Iteration structure below).
49
75
 
50
- For gaps the user wants to **defer**:
76
+ For findings the user wants to **defer**:
51
77
  - Create backlog docs in `docs/backlog/` using the `todo` skill to capture what's known so far:
52
78
  - The problem/need (e.g. "currently we can only do X, but we want Y")
53
79
  - Existing context and open questions that surfaced during review
@@ -56,26 +82,30 @@ For gaps the user wants to **defer**:
56
82
  - Create separate backlog docs only for very different, large deferred tasks
57
83
  - Assign the next available 3-digit prefix in `docs/backlog` for each new doc
58
84
 
85
+ For risks the user explicitly accepts:
86
+ - Record the accepted risk and rationale in the review section.
87
+ - Do not create a backlog item unless the user also wants future tracking.
88
+
59
89
  ## Iteration structure
60
90
 
61
- When the user chooses to iterate on gaps, append to the **active plan document**:
91
+ When the user chooses to iterate on findings, append to the **active plan document**:
62
92
 
63
93
  ```markdown
64
94
  ## Review
65
95
 
66
- <gap analysis findings>
96
+ <review findings and proposed fix/defer lists>
67
97
 
68
98
  ## Iteration {n} — Ideation
69
99
 
70
- ### Gap 1 of {total}: <gap title>
100
+ ### Finding 1 of {total}: <finding title>
71
101
  <ideation content: context, approaches, pros/cons, chosen approach, rationale>
72
102
 
73
- ### Gap 2 of {total}: <gap title>
103
+ ### Finding 2 of {total}: <finding title>
74
104
  ...
75
105
 
76
106
  ## Iteration {n} — Plan
77
107
 
78
- <condensed plan for all gaps: architecture decisions, file changes, contracts>
108
+ <condensed plan for all selected findings: architecture decisions, file changes, contracts>
79
109
 
80
110
  ## Iteration {n} — Phases
81
111
 
@@ -84,16 +114,16 @@ When the user chooses to iterate on gaps, append to the **active plan document**
84
114
  ```
85
115
 
86
116
  The ideation within this section follows the same rules as the ideation skill:
87
- - Build an open-item map for selected gaps.
117
+ - Build an open-item map for selected findings.
88
118
  - Immediately use `explore` on the highest-priority planning blockers in chat, in batches of 3 where possible.
89
119
  - Record accepted decisions only after consent.
90
120
  - Keep the active plan document lightweight until decisions are accepted.
91
121
 
92
- **Ideate all selected gaps first**, then condense into a plan section, then break into phases/tasks. Do not run the full cycle per individual gap.
122
+ **Ideate all selected findings first**, then condense into a plan section, then break into phases/tasks. Do not run the full cycle per individual finding.
93
123
 
94
124
  ## Follow-up questions before switching modes
95
125
 
96
- **After ideation for all gaps is complete, ask implementation-specific follow-up questions before moving forward.** Gaps identified during review are often under-specified. Proactively ask about:
126
+ **After ideation for all selected findings is complete, ask implementation-specific follow-up questions before moving forward.** Findings identified during review are often under-specified. Proactively ask about:
97
127
 
98
128
  - **Placement decisions**: Where should new files/configs live?
99
129
  - **Tool/dependency choices**: Which specific library, image, or tool version to use?
@@ -103,25 +133,29 @@ The ideation within this section follows the same rules as the ideation skill:
103
133
 
104
134
  ## Guardrails
105
135
 
106
- - Do not perform cleanup/release tasks in this mode; use wrapup mode for that.
136
+ - Do not rush from review to wrapup. Assume review usually uncovers follow-up work that deserves careful triage.
137
+ - Do not perform release-prep tasks in this mode; use wrapup mode for that. Review mode may identify cleanup, simplification, comments, docs, and validation work, then route it through iteration or deferral.
107
138
  - Do not remove `docs/plans/<nnn>-<topic>.md` in review mode; plan removal happens in wrapup after report approval.
108
139
  - If big remaining work is identified, discuss tradeoffs/solutions in chat first.
109
- - Only convert review findings into iteration content after the user confirms which gaps to address.
140
+ - Only convert review findings into iteration content after the user confirms which findings to address.
110
141
  - For newly uncovered work, always go through ideation first — never skip straight to tasks or implementation.
111
142
  - If the user's response involves clarifying approach or scope, treat this as still in the clarification loop — ask follow-ups for any remaining ambiguity.
112
143
  - Do not claim review completion without test evidence for impacted packages (or explicit user-approved skips).
113
144
  - Do not claim review completion without architecture compliance findings.
145
+ - Do not claim review completion until every required output section has been assessed with findings or `No findings`.
146
+ - Do not recommend wrapup until the proposed fixes/improvements list has been triaged.
114
147
  - Do not decide that work is out of scope yourself. Only create backlog items after the user explicitly agrees to defer them.
115
148
 
116
149
  ## Exit criteria
117
150
 
118
- - Gaps are triaged with explicit user decisions (now vs defer).
119
- - If iterating: ideation for all selected gaps is recorded in the plan doc, and user has confirmed next step.
120
- - If deferring: backlog docs were created for user-deferred gaps.
151
+ - Findings are triaged with explicit user decisions (fix/improve now, defer, or accept risk).
152
+ - If iterating: ideation for all selected findings is recorded in the plan doc, and user has confirmed next step.
153
+ - If deferring: backlog docs were created for user-deferred findings.
154
+ - Accepted risks, if any, are recorded with rationale.
121
155
  - Deferred full/slow test suites for impacted packages were executed and reported, or explicitly skipped with user approval.
122
156
  - Architecture compliance was checked against the plan's cited architecture docs and reported.
123
157
  - The active plan doc has `status: Review` and is committed unless the repo ignores `docs/`.
124
158
  - User has explicitly confirmed whether to:
125
- - **Iterate** — proceed to plan the ideated gaps (manually via plan mode, or via automatic mode for plan → tasks → implementation → review)
159
+ - **Iterate** — proceed to plan the ideated findings (manually via plan mode, or via automatic mode for plan → tasks → implementation → review)
126
160
  - **Wrapup** — no more work needed, move to wrapup mode
127
- - **Defer all** — all gaps deferred, move to wrapup mode
161
+ - **Defer all** — all findings deferred, move to wrapup mode
@@ -21,6 +21,7 @@ Run only when the user explicitly confirms tasks mode.
21
21
  - full/slow suites deferred to review.
22
22
  6. Write detailed test specifications for every phase (see **Test specification** below).
23
23
  7. Ensure phases are commit-friendly (one commit per phase).
24
+ 8. When work spans repositories, separate phases and validation by repository.
24
25
 
25
26
  ## Parallel execution
26
27
 
@@ -18,6 +18,7 @@ description: Enforce the explicit mode cadence (ideation -> plan -> tasks -> imp
18
18
 
19
19
  ## Mode selection at task start
20
20
 
21
+ - At task start, inspect `package.json` workspaces and Git roots under their package paths. If work spans repositories, handle branches, commits, changesets, and PRs separately for each repository.
21
22
  - If the user has already explicitly chosen a mode (or explicitly called a mode skill), enter that mode directly.
22
23
  - `automatic` is a special meta mode and can only be entered when the user explicitly requests it.
23
24
  - Never auto-suggest `automatic` in startup prompts.
@@ -76,6 +77,7 @@ These transition gates apply to standard modes. `automatic` mode is an explicit
76
77
  - One task/thread uses one active plan doc from ideation through review. Do not create additional plan docs for the same thread.
77
78
  - Update the active plan doc `status` frontmatter when entering each mode.
78
79
  - Before switching from ideation, plan, tasks, or review, commit the final active plan state unless the repo ignores `docs/`.
80
+ - Existing files in `docs/reports` are historical snapshots. Never edit them; apply later documentation fixes and renames only to current documentation.
79
81
  - After each completed implementation phase, the on-disk plan file MUST be updated before moving to the next phase.
80
82
  - Each implementation phase MUST be committed with code changes and the updated plan together.
81
83
  - Mode changes are never implicit; every mode switch requires explicit user confirmation.
@@ -44,6 +44,7 @@ Also treat any user request to prepare/open/update a PR, or draft PR title/body/
44
44
  13. Changeset handling — see the dedicated section below.
45
45
  14. Draft a PR title and PR message/body summarizing changes, validation, architecture doc updates, and follow-up notes.
46
46
  15. **Final commit**: all cleanup (comments, dead code removal, plan deletion, report) must be committed before creating the PR.
47
+ 16. Prepare commits, changesets, and PRs separately for each repository.
47
48
 
48
49
  ## Report quality
49
50
 
@@ -73,6 +74,10 @@ The report replaces the plan as the permanent record. Any agent working on code
73
74
 
74
75
  **Sizing guideline:** If the plan was 500+ lines, the report should be at least 150-300 lines. A 10-line report for a 3000-line plan means critical information was lost.
75
76
 
77
+ ## Reusable package wording
78
+
79
+ For nested repositories and reusable packages under `packages/`, keep root-project, app, client, and product names out of branch names, commit messages, PR titles/bodies, changeset filenames, and changeset prose. Use generic capability language. Exact package names are allowed where tooling requires them, such as changeset frontmatter.
80
+
76
81
  ## Changeset handling
77
82
 
78
83
  **Always create a changeset** when package code changed, even if other changesets already exist. Each changeset becomes a separate entry in the public changelog via CI/CD, so it should describe what users of the library need to know about THIS set of changes.