@memnexus-ai/mx-agent-cli 0.1.28 → 0.1.30
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/dist/commands/new.d.ts.map +1 -1
- package/dist/commands/new.js +4 -1
- package/dist/commands/new.js.map +1 -1
- package/dist/commands/start.d.ts.map +1 -1
- package/dist/commands/start.js +83 -10
- package/dist/commands/start.js.map +1 -1
- package/dist/lib/templates.d.ts +8 -0
- package/dist/lib/templates.d.ts.map +1 -1
- package/dist/lib/templates.js +551 -0
- package/dist/lib/templates.js.map +1 -1
- package/package.json +1 -1
- package/dist/__tests__/init-validation.test.d.ts +0 -2
- package/dist/__tests__/init-validation.test.d.ts.map +0 -1
- package/dist/__tests__/init-validation.test.js +0 -32
- package/dist/__tests__/init-validation.test.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;
|
|
1
|
+
{"version":3,"file":"new.d.ts","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAiBH,MAAM,WAAW,UAAU;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AA4BD,wBAAsB,MAAM,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,UAAU,GAAG,OAAO,CAAC,IAAI,CAAC,CAmHpF"}
|
package/dist/commands/new.js
CHANGED
|
@@ -25,7 +25,8 @@ import { join, resolve } from 'path';
|
|
|
25
25
|
import { spawnSync } from 'child_process';
|
|
26
26
|
import chalk from 'chalk';
|
|
27
27
|
import { runInit } from './init.js';
|
|
28
|
-
import {
|
|
28
|
+
import { PROJECT_CONFIG_DEFAULTS } from '../lib/project-config.js';
|
|
29
|
+
import { newProjectDockerfileTemplate, newProjectDevcontainerJsonTemplate, newProjectPostCreateShTemplate, newProjectPostStartShTemplate, newProjectGitignoreTemplate, teamBuilderRoleguideTemplate, } from '../lib/templates.js';
|
|
29
30
|
/** Validate project name: letters, digits, hyphens/underscores, 1-50 chars, must start with letter or digit */
|
|
30
31
|
function validateProjectName(name) {
|
|
31
32
|
if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]{0,49}$/.test(name)) {
|
|
@@ -116,6 +117,8 @@ export async function runNew(projectName, options) {
|
|
|
116
117
|
configSource: options.configSource,
|
|
117
118
|
force: false,
|
|
118
119
|
});
|
|
120
|
+
// 8b. Write team-builder roleguide so mx-agent start team-builder works out of the box
|
|
121
|
+
writeFile(join(outputDir, PROJECT_CONFIG_DEFAULTS.roleguidesDir, 'team-builder.md'), teamBuilderRoleguideTemplate());
|
|
119
122
|
// 9. Initial git commit
|
|
120
123
|
console.log();
|
|
121
124
|
console.log(chalk.dim(' Creating initial commit...'));
|
package/dist/commands/new.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new.js","sourceRoot":"","sources":["../../src/commands/new.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,aAAa,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAClF,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EACL,4BAA4B,EAC5B,kCAAkC,EAClC,8BAA8B,EAC9B,6BAA6B,EAC7B,2BAA2B,
|
|
1
|
+
{"version":3,"file":"new.js","sourceR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AAO,CAAC,GAAG,CAAC,yCAAyC,CAAC,CAAC;IACvD,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,CAAC,IAAI,CAAC,6BAA6B,CAAC,EAAE,CAAC,CAAC;IACjE,OAAO,CAAC,GAAG,EAAE,CAAC;IACd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,sEAAsE,CAAC,CAAC,CAAC;IAC/F,OAAO,CAAC,GAAG,EAAE,CAAC;AAChB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;
|
|
1
|
+
{"version":3,"file":"start.d.ts","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAuBH,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,QAAQ,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmOnE"}
|
package/dist/commands/start.js
CHANGED
|
@@ -4,9 +4,11 @@
|
|
|
4
4
|
* Starts an isolated Claude session for a named team in its worktree.
|
|
5
5
|
*/
|
|
6
6
|
import { spawnSync } from 'child_process';
|
|
7
|
+
import { existsSync, mkdirSync } from 'fs';
|
|
8
|
+
import { join } from 'path';
|
|
7
9
|
import chalk from 'chalk';
|
|
8
|
-
import { findProjectRoot, findWorktreePath, getSlot, getCurrentBranch, } from '../lib/worktree.js';
|
|
9
|
-
import { syncClaudeConfig, deployClaudeMd, writeClaudeLocal, launchClaudeSession } from '../lib/claude.js';
|
|
10
|
+
import { findProjectRoot, findWorktreePath, getSlot, getCurrentBranch, assignSlot, generateWorktreeDirName, generateBranchName, fetchOrigin, createGitWorktree, addToGitSafeDirectory, createHuskySymlink, } from '../lib/worktree.js';
|
|
11
|
+
import { syncClaudeConfig, deployClaudeMd, writeClaudeLocal, launchClaudeSession, logSuccess } from '../lib/claude.js';
|
|
10
12
|
import { getTeam } from '../lib/catalog.js';
|
|
11
13
|
import { loadProjectConfig, resolveProjectConfig } from '../lib/project-config.js';
|
|
12
14
|
export async function runStart(options) {
|
|
@@ -21,12 +23,35 @@ export async function runStart(options) {
|
|
|
21
23
|
}
|
|
22
24
|
const cfg = resolveProjectConfig(loadProjectConfig(projectRoot));
|
|
23
25
|
// ── 1. Locate the worktree ─────────────────────────────────────────
|
|
24
|
-
|
|
26
|
+
let worktreePath = findWorktreePath(projectRoot, name, cfg.worktreeDir);
|
|
25
27
|
if (!worktreePath) {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
// Auto-provision: if a roleguide exists for this name but no worktree does,
|
|
29
|
+
// create the worktree automatically. This lets `mx-agent start team-builder`
|
|
30
|
+
// work in a fresh container without a prior `mx-agent create` call.
|
|
31
|
+
const candidateRoleguide = [
|
|
32
|
+
join(projectRoot, cfg.roleguidesDir, `${name}.md`),
|
|
33
|
+
join(projectRoot, cfg.roleguidesDir, `${name}-leader.md`),
|
|
34
|
+
].find(p => existsSync(p));
|
|
35
|
+
if (candidateRoleguide) {
|
|
36
|
+
console.log(chalk.dim(` No worktree found for '${name}' — auto-provisioning from roleguide...`));
|
|
37
|
+
const slot = assignSlot(projectRoot, name, cfg.worktreeDir);
|
|
38
|
+
const worktreeDirName = generateWorktreeDirName(name);
|
|
39
|
+
const branch = generateBranchName(name);
|
|
40
|
+
const newWorktreePath = join(projectRoot, cfg.worktreeDir, worktreeDirName);
|
|
41
|
+
mkdirSync(join(projectRoot, cfg.worktreeDir), { recursive: true });
|
|
42
|
+
fetchOrigin(projectRoot);
|
|
43
|
+
createGitWorktree(newWorktreePath, branch, cfg.baseBranch, projectRoot);
|
|
44
|
+
addToGitSafeDirectory(newWorktreePath);
|
|
45
|
+
createHuskySymlink(projectRoot, newWorktreePath);
|
|
46
|
+
logSuccess(`Worktree provisioned: ${newWorktreePath}`);
|
|
47
|
+
worktreePath = newWorktreePath;
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
console.error(chalk.red(`Team '${name}' not found.`));
|
|
51
|
+
console.error(chalk.dim(` No worktree found in ${projectRoot}/${cfg.worktreeDir}/ matching '${name}' or '${name}-*'`));
|
|
52
|
+
console.error(chalk.dim(` Run: mx-agent create --roleguide <path> --name ${name}`));
|
|
53
|
+
process.exit(1);
|
|
54
|
+
}
|
|
30
55
|
}
|
|
31
56
|
// ── 2. Resolve slot ────────────────────────────────────────────────
|
|
32
57
|
// The slot key in .slots.json may be the full dir name (e.g. "retrieval-20260222")
|
|
@@ -64,6 +89,8 @@ export async function runStart(options) {
|
|
|
64
89
|
// ── 4. Rebase worktree onto latest origin/<baseBranch> ───────────
|
|
65
90
|
// Ensures the worktree has the latest roleguides, CLI fixes, and
|
|
66
91
|
// templates even if it was created before those commits landed.
|
|
92
|
+
// Rebase failure is blocking — a session must not start on stale state.
|
|
93
|
+
const DIVERGENCE_WARN_THRESHOLD = 20;
|
|
67
94
|
console.log(chalk.dim(` Syncing with origin/${cfg.baseBranch}...`));
|
|
68
95
|
const fetchResult = spawnSync('git', ['fetch', 'origin', cfg.baseBranch], {
|
|
69
96
|
cwd: worktreePath,
|
|
@@ -71,19 +98,65 @@ export async function runStart(options) {
|
|
|
71
98
|
encoding: 'utf-8',
|
|
72
99
|
});
|
|
73
100
|
if (fetchResult.status !== 0) {
|
|
101
|
+
// Fetch failure is non-fatal (offline / no remote) but surfaced clearly.
|
|
74
102
|
console.log(chalk.yellow(` ⚠ Could not fetch origin/${cfg.baseBranch} — starting with local state.`));
|
|
103
|
+
const fetchErr = fetchResult.stderr?.trim();
|
|
104
|
+
if (fetchErr)
|
|
105
|
+
console.log(chalk.dim(` ${fetchErr}`));
|
|
75
106
|
}
|
|
76
107
|
else {
|
|
108
|
+
// ── Divergence check ─────────────────────────────────────────
|
|
109
|
+
const behindR = spawnSync('git', ['rev-list', '--count', `HEAD..origin/${cfg.baseBranch}`], { cwd: worktreePath, stdio: 'pipe', encoding: 'utf-8' });
|
|
110
|
+
const aheadR = spawnSync('git', ['rev-list', '--count', `origin/${cfg.baseBranch}..HEAD`], { cwd: worktreePath, stdio: 'pipe', encoding: 'utf-8' });
|
|
111
|
+
const commitsBehind = parseInt(behindR.stdout.trim(), 10) || 0;
|
|
112
|
+
const commitsAhead = parseInt(aheadR.stdout.trim(), 10) || 0;
|
|
113
|
+
if (commitsBehind >= DIVERGENCE_WARN_THRESHOLD) {
|
|
114
|
+
console.log();
|
|
115
|
+
console.log(chalk.yellow(` ⚠ This branch is ${commitsBehind} commits behind origin/${cfg.baseBranch}.`));
|
|
116
|
+
if (commitsAhead > 0) {
|
|
117
|
+
console.log(chalk.yellow(` It also has ${commitsAhead} unmerged commit${commitsAhead === 1 ? '' : 's'}.`));
|
|
118
|
+
console.log(chalk.yellow(` Consider opening a PR for completed work before continuing to reduce conflict risk.`));
|
|
119
|
+
}
|
|
120
|
+
console.log();
|
|
121
|
+
}
|
|
122
|
+
// ── Rebase ───────────────────────────────────────────────────
|
|
77
123
|
const rebaseResult = spawnSync('git', ['rebase', `origin/${cfg.baseBranch}`], {
|
|
78
124
|
cwd: worktreePath,
|
|
79
125
|
stdio: 'pipe',
|
|
80
126
|
encoding: 'utf-8',
|
|
81
127
|
});
|
|
82
128
|
if (rebaseResult.status !== 0) {
|
|
83
|
-
//
|
|
129
|
+
// Get conflicting files before aborting (rebase is paused, not yet aborted).
|
|
130
|
+
const conflictR = spawnSync('git', ['diff', '--name-only', '--diff-filter=U'], { cwd: worktreePath, stdio: 'pipe', encoding: 'utf-8' });
|
|
131
|
+
const conflictFiles = conflictR.stdout.trim().split('\n').filter(Boolean);
|
|
84
132
|
spawnSync('git', ['rebase', '--abort'], { cwd: worktreePath, stdio: 'pipe' });
|
|
85
|
-
console.
|
|
86
|
-
console.
|
|
133
|
+
console.error();
|
|
134
|
+
console.error(chalk.red.bold(` ✗ Rebase onto origin/${cfg.baseBranch} failed — session blocked.`));
|
|
135
|
+
console.error(chalk.dim(' ─────────────────────────────────────────────'));
|
|
136
|
+
if (conflictFiles.length > 0) {
|
|
137
|
+
console.error(chalk.red(` Conflicting files (${conflictFiles.length}):`));
|
|
138
|
+
for (const f of conflictFiles) {
|
|
139
|
+
console.error(chalk.dim(` • ${f}`));
|
|
140
|
+
}
|
|
141
|
+
console.error();
|
|
142
|
+
}
|
|
143
|
+
console.error(chalk.bold(' To resolve:'));
|
|
144
|
+
console.error(` 1. Run the rebase manually:`);
|
|
145
|
+
console.error(chalk.cyan(` git -C ${worktreePath} rebase origin/${cfg.baseBranch}`));
|
|
146
|
+
console.error(` 2. Fix each conflict, then stage the resolved files:`);
|
|
147
|
+
console.error(chalk.cyan(` git -C ${worktreePath} add <file>`));
|
|
148
|
+
console.error(` 3. Continue the rebase:`);
|
|
149
|
+
console.error(chalk.cyan(` git -C ${worktreePath} rebase --continue`));
|
|
150
|
+
console.error(` 4. Re-run:`);
|
|
151
|
+
console.error(chalk.cyan(` mx-agent start ${name}`));
|
|
152
|
+
console.error();
|
|
153
|
+
console.error(chalk.dim(` Tip: if this branch has completed work, open a PR first.`));
|
|
154
|
+
console.error(chalk.dim(` Smaller PRs merged frequently reduce conflict surface.`));
|
|
155
|
+
console.error();
|
|
156
|
+
process.exit(1);
|
|
157
|
+
}
|
|
158
|
+
if (commitsBehind > 0) {
|
|
159
|
+
console.log(chalk.green(` ✓ Rebased ${commitsBehind} commit${commitsBehind === 1 ? '' : 's'} from origin/${cfg.baseBranch}`));
|
|
87
160
|
}
|
|
88
161
|
else {
|
|
89
162
|
console.log(chalk.green(` ✓ Worktree up to date with origin/${cfg.baseBranch}`));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"start.js","sourceRoot":"","sources":["../../src/commands/start.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC1C,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAA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AC;IACtD,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,iDAAiD,CAAC,CAAC,CAAC;IAC1E,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,mCAAmC,CAAC,CAAC;IACtE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,sCAAsC,CAAC,CAAC;IACzE,OAAO,CAAC,GAAG,CAAC,KAAK,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,+BAA+B,CAAC,CAAC;IAClE,OAAO,CAAC,GAAG,EAAE,CAAC;IAEd,sEAAsE;IACtE,+BAA+B;IAC/B,gFAAgF;IAChF,oFAAoF;IACpF,+DAA+D;IAC/D,MAAM,aAAa,GACjB,2EAA2E;QAE3E,iCAAiC,SAAS,IAAI;QAC9C,sFAAsF;QAEtF,0EAA0E;QAC1E,2HAA2H;QAE3H,iEAAiE;QACjE,iCAAiC,IAAI,uDAAuD;QAC5F,yIAAyI;QACzI,wGAAwG,CAAC;IAE3G,sEAAsE;IACtE,mBAAmB,CAAC;QAClB,YAAY;QACZ,YAAY,EAAE,eAAe;QAC7B,MAAM;QACN,IAAI;QACJ,aAAa;QACb,QAAQ,EAAE,IAAI;KACf,CAAC,CAAC;AACL,CAAC"}
|
package/dist/lib/templates.d.ts
CHANGED
|
@@ -26,4 +26,12 @@ export declare function newProjectDevcontainerJsonTemplate(projectName: string):
|
|
|
26
26
|
export declare function newProjectPostCreateShTemplate(projectName: string): string;
|
|
27
27
|
export declare function newProjectPostStartShTemplate(projectName: string): string;
|
|
28
28
|
export declare function newProjectGitignoreTemplate(): string;
|
|
29
|
+
/**
|
|
30
|
+
* Team-builder roleguide, adapted for external projects.
|
|
31
|
+
*
|
|
32
|
+
* Written to mx-agent-system/roleguides/team-builder.md by mx-agent new.
|
|
33
|
+
* Based on the MemNexus internal team-builder roleguide; monorepo-specific
|
|
34
|
+
* paths removed and replaced with generic project-relative references.
|
|
35
|
+
*/
|
|
36
|
+
export declare function teamBuilderRoleguideTemplate(): string;
|
|
29
37
|
//# sourceMappingURL=templates.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QA8DlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,sjEAuEtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,4dAkB9B,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,MAAM,CAsBrD;AAED,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiC9E;AAED,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,
|
|
1
|
+
{"version":3,"file":"templates.d.ts","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,eAAO,MAAM,sBAAsB,QA8DlC,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,0BAA0B,sjEAuEtC,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,4dAkB9B,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,MAAM,CAsBrD;AAED,wBAAgB,kCAAkC,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAiC9E;AAED,wBAAgB,8BAA8B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAgE1E;AAED,wBAAgB,6BAA6B,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAkBzE;AAED,wBAAgB,2BAA2B,IAAI,MAAM,CAwBpD;AAED;;;;;;GAMG;AACH,wBAAgB,4BAA4B,IAAI,MAAM,CAshBrD"}
|
package/dist/lib/templates.js
CHANGED
|
@@ -247,6 +247,15 @@ fi
|
|
|
247
247
|
echo "Configuring Git..."
|
|
248
248
|
git config --global --add safe.directory /workspace
|
|
249
249
|
|
|
250
|
+
# Configure npm global prefix (avoids EACCES when running as non-root vscode user)
|
|
251
|
+
echo "Configuring npm..."
|
|
252
|
+
mkdir -p "\$HOME/.npm-global"
|
|
253
|
+
npm config set prefix "\$HOME/.npm-global"
|
|
254
|
+
if ! grep -q 'export PATH="\$HOME/.npm-global/bin:\$PATH"' ~/.bashrc 2>/dev/null; then
|
|
255
|
+
echo 'export PATH="\$HOME/.npm-global/bin:\$PATH"' >> ~/.bashrc
|
|
256
|
+
fi
|
|
257
|
+
export PATH="\$HOME/.npm-global/bin:\$PATH"
|
|
258
|
+
|
|
250
259
|
# Install Claude Code CLI
|
|
251
260
|
echo "Installing Claude Code..."
|
|
252
261
|
curl -fsSL https://claude.ai/install.sh | bash
|
|
@@ -322,4 +331,546 @@ Thumbs.db
|
|
|
322
331
|
.worktrees/
|
|
323
332
|
`;
|
|
324
333
|
}
|
|
334
|
+
/**
|
|
335
|
+
* Team-builder roleguide, adapted for external projects.
|
|
336
|
+
*
|
|
337
|
+
* Written to mx-agent-system/roleguides/team-builder.md by mx-agent new.
|
|
338
|
+
* Based on the MemNexus internal team-builder roleguide; monorepo-specific
|
|
339
|
+
* paths removed and replaced with generic project-relative references.
|
|
340
|
+
*/
|
|
341
|
+
export function teamBuilderRoleguideTemplate() {
|
|
342
|
+
return `# Team Builder Roleguide
|
|
343
|
+
|
|
344
|
+
You are the **team builder** — a facilitator agent whose sole purpose is to help a product owner
|
|
345
|
+
define and provision a new agent team. You are NOT a team leader. You do not run iterations. You do
|
|
346
|
+
not manage ongoing work. Your session has one outcome: a fully provisioned team that can start its
|
|
347
|
+
first iteration immediately after you hand off.
|
|
348
|
+
|
|
349
|
+
Your session ends when:
|
|
350
|
+
1. The roleguide file is written to disk.
|
|
351
|
+
2. \`mx-agent create\` has been run and confirmed successful.
|
|
352
|
+
3. You have told the product owner exactly what was created and what to do next.
|
|
353
|
+
|
|
354
|
+
---
|
|
355
|
+
|
|
356
|
+
## What You Are and Are Not
|
|
357
|
+
|
|
358
|
+
| You ARE | You are NOT |
|
|
359
|
+
|---|---|
|
|
360
|
+
| A conversational facilitator who elicits team definition | A team leader who runs continuous improvement loops |
|
|
361
|
+
| A drafter who produces a complete roleguide | An implementer who writes product code |
|
|
362
|
+
| A provisioner who runs \`mx-agent create\` | A manager who delegates ongoing tasks |
|
|
363
|
+
| A one-session agent whose job ends at handoff | A long-running team with named memory anchors |
|
|
364
|
+
|
|
365
|
+
You have no named memory anchors of your own. You do not save \`team-builder-leader-state\`. Your
|
|
366
|
+
context window IS your state — this is a short, focused session.
|
|
367
|
+
|
|
368
|
+
---
|
|
369
|
+
|
|
370
|
+
## What You Have Access To
|
|
371
|
+
|
|
372
|
+
Before asking the product owner any questions, orient yourself using these resources:
|
|
373
|
+
|
|
374
|
+
**Existing roleguides (read as structure examples):**
|
|
375
|
+
Check \`mx-agent-system/roleguides/\` for any roleguides already in the project. Read them to
|
|
376
|
+
internalize structure and tone before drafting. If this is a new project with no other roleguides
|
|
377
|
+
yet, use the mandatory sections checklist below as your structure reference.
|
|
378
|
+
|
|
379
|
+
**Team catalog (understand existing interfaces before designing new ones):**
|
|
380
|
+
\`\`\`
|
|
381
|
+
mx-agent-system/teams/ ← one .md per registered team
|
|
382
|
+
\`\`\`
|
|
383
|
+
|
|
384
|
+
**CLI for provisioning:**
|
|
385
|
+
\`\`\`bash
|
|
386
|
+
mx-agent create --roleguide <path> --name <team-slug>
|
|
387
|
+
\`\`\`
|
|
388
|
+
|
|
389
|
+
**Project root:** Check \`$CLAUDE_WORKTREE_PATH\` for your worktree path; the project root is one
|
|
390
|
+
level up (or detected automatically by the CLI).
|
|
391
|
+
|
|
392
|
+
---
|
|
393
|
+
|
|
394
|
+
## Session Flow
|
|
395
|
+
|
|
396
|
+
Follow these steps in order. Do not skip steps. Do not rush past review and approval.
|
|
397
|
+
|
|
398
|
+
\`\`\`
|
|
399
|
+
1. ORIENT → Read existing roleguides + catalog
|
|
400
|
+
↓
|
|
401
|
+
2. ELICIT → Ask the product owner 8 questions, one at a time
|
|
402
|
+
↓
|
|
403
|
+
3. DRAFT → Produce the roleguide section by section
|
|
404
|
+
↓
|
|
405
|
+
4. REVIEW → Present summary, get explicit approval
|
|
406
|
+
↓
|
|
407
|
+
5. WRITE → Save roleguide to mx-agent-system/roleguides/<team-slug>-leader.md
|
|
408
|
+
↓
|
|
409
|
+
6. PROVISION → Run mx-agent create, confirm success
|
|
410
|
+
↓
|
|
411
|
+
7. HANDOFF → Tell the product owner exactly what was created and what to do next
|
|
412
|
+
\`\`\`
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
### Step 1: ORIENT — Read before asking anything
|
|
417
|
+
|
|
418
|
+
Before engaging the product owner, read any existing roleguides in \`mx-agent-system/roleguides/\`
|
|
419
|
+
and review the team catalog at \`mx-agent-system/teams/\`. Your goal is to internalize:
|
|
420
|
+
- The structure and tone of a well-formed roleguide
|
|
421
|
+
- What sections are mandatory vs. team-specific
|
|
422
|
+
- What existing teams own (so you can help the product owner define non-overlapping scope)
|
|
423
|
+
- What the agent roster examples look like across teams
|
|
424
|
+
|
|
425
|
+
Only after you have reviewed the reference material should you begin eliciting requirements. Say to
|
|
426
|
+
the product owner: "I've reviewed the existing teams and roleguide patterns. Let's define your new
|
|
427
|
+
team. I'll ask you a series of questions one at a time."
|
|
428
|
+
|
|
429
|
+
---
|
|
430
|
+
|
|
431
|
+
### Step 2: ELICIT — Eight questions, in order
|
|
432
|
+
|
|
433
|
+
Ask these questions one at a time. After each answer, acknowledge what you heard and confirm it
|
|
434
|
+
before moving to the next. Do not ask multiple questions at once.
|
|
435
|
+
|
|
436
|
+
**Q1 — Team name**
|
|
437
|
+
|
|
438
|
+
> "What is the canonical slug for this team? This is the kebab-case identifier used everywhere:
|
|
439
|
+
> named memory prefixes, worktree naming, routing, catalog. Examples: \`retrieval\`, \`mcp\`,
|
|
440
|
+
> \`devops-pipeline\`, \`marketing\`. Also, what's a human-friendly display name for it?"
|
|
441
|
+
|
|
442
|
+
Validate: slug is kebab-case, no spaces, no uppercase. If the product owner gives something like
|
|
443
|
+
"My Team" or "myTeam", propose the correct slug and confirm.
|
|
444
|
+
|
|
445
|
+
**Slug validation (mandatory — do not skip):** The slug MUST match the regex
|
|
446
|
+
\`^[a-z][a-z0-9-]{0,48}[a-z0-9]$\` — lowercase letters, digits, and hyphens only; starts and ends
|
|
447
|
+
with a letter or digit; 2–50 characters total. Reject and re-prompt on any other input. Do not
|
|
448
|
+
proceed to the conflict pre-flight or Q2 until the slug passes this regex.
|
|
449
|
+
|
|
450
|
+
> Example valid slugs: \`retrieval\`, \`mcp\`, \`devops-pipeline\`, \`marketing-qa\`
|
|
451
|
+
> Example invalid slugs: \`My Team\` (spaces), \`myTeam\` (uppercase), \`-retrieval\` (leading hyphen),
|
|
452
|
+
> \`a\` (too short), a slug longer than 50 characters, or any slug containing \`..\`, \`/\`, \`\\\\\`,
|
|
453
|
+
> \`;\`, \`&\`, \`|\`, \`$\`, \`\\\`\`, \`(\`, \`)\`, \`>\`, \`<\`, or other shell metacharacters
|
|
454
|
+
|
|
455
|
+
**Display name validation:** Confirm the display name is plain text only — no shell metacharacters
|
|
456
|
+
(\`$\`, \`\\\`\`, \`&\`, \`|\`, \`;\`, \`<\`, \`>\`). If the product owner includes any, strip them and
|
|
457
|
+
confirm the cleaned version.
|
|
458
|
+
|
|
459
|
+
**Slug conflict pre-flight (do this immediately after Q1):** Run \`mx-agent list\` and check whether
|
|
460
|
+
the proposed slug already appears in the catalog or has an existing worktree directory. If a
|
|
461
|
+
conflict is found, surface it before proceeding:
|
|
462
|
+
|
|
463
|
+
> "A team named \`<slug>\` already exists in the catalog. Its purpose is: [description]. Did you
|
|
464
|
+
> mean to update that team, or do you want a different name for your new team?"
|
|
465
|
+
|
|
466
|
+
Do not proceed to Q2 until the slug is confirmed as non-conflicting.
|
|
467
|
+
|
|
468
|
+
**Q2 — Problem statement**
|
|
469
|
+
|
|
470
|
+
> "What problem does this team exist to solve? What's broken or missing without it? Try to describe
|
|
471
|
+
> this in terms of user pain or business impact, not technical implementation."
|
|
472
|
+
|
|
473
|
+
Listen for: specificity. Vague answers ("make things better") need probing. Ask "what does that
|
|
474
|
+
failure look like in practice?" if needed.
|
|
475
|
+
|
|
476
|
+
**Q3 — User-visible outcomes**
|
|
477
|
+
|
|
478
|
+
> "What does the product owner see when this team is working correctly? Be specific — what gets
|
|
479
|
+
> shipped to preview that a real user can interact with or observe?"
|
|
480
|
+
|
|
481
|
+
This becomes the team's definition of done. If the answer is abstract ("better quality"), probe for
|
|
482
|
+
the concrete artifact: a test result, a report, a UI change, a metric moving.
|
|
483
|
+
|
|
484
|
+
**Q4 — Scope**
|
|
485
|
+
|
|
486
|
+
> "What does this team own? And just as important — what does it explicitly NOT own? Name adjacent
|
|
487
|
+
> areas that might seem like this team's job but aren't."
|
|
488
|
+
|
|
489
|
+
Help the product owner think through overlaps with existing teams. Reference the catalog
|
|
490
|
+
(\`mx-agent-system/teams/\`) as you draft.
|
|
491
|
+
|
|
492
|
+
**Q5 — North star metric**
|
|
493
|
+
|
|
494
|
+
> "What is the one metric that proves this team is working? How is it measured? What's the current
|
|
495
|
+
> baseline? What's the target?"
|
|
496
|
+
|
|
497
|
+
One metric only. If the product owner lists several, help them pick the primary. Secondary KPIs go
|
|
498
|
+
in the roleguide but the north star must be singular.
|
|
499
|
+
|
|
500
|
+
**Q6 — Interfaces**
|
|
501
|
+
|
|
502
|
+
> "Which other teams does this team interact with? What does it consume from them? What does it
|
|
503
|
+
> produce for them?"
|
|
504
|
+
|
|
505
|
+
Map to existing teams in the catalog. Also ask: "Are there any external services, APIs, or tools
|
|
506
|
+
this team depends on?"
|
|
507
|
+
|
|
508
|
+
**Q7 — Agent roster**
|
|
509
|
+
|
|
510
|
+
> "What specialist agents does the team lead use? I'll suggest a starting set based on the domain
|
|
511
|
+
> — you can adjust."
|
|
512
|
+
|
|
513
|
+
Offer examples based on the domain the product owner described. Every team needs four always-active
|
|
514
|
+
agents:
|
|
515
|
+
- **Bar Raiser** — process adherence, blocks when mechanisms aren't followed
|
|
516
|
+
- **Red Team** — adversarial testing, challenges gap selection and validates implementations
|
|
517
|
+
- **Security Reviewer** — reviews code/config changes, Must Fix findings block PRs
|
|
518
|
+
- **Dogfood Auditor** — validates the team uses MemNexus effectively, surfaces product improvement signals
|
|
519
|
+
|
|
520
|
+
Then propose domain-specific agents based on what the product owner described in Q1–Q6.
|
|
521
|
+
|
|
522
|
+
**Q8 — Domain-specific context**
|
|
523
|
+
|
|
524
|
+
> "Is there anything unique about this team's domain that Claude needs to know to operate
|
|
525
|
+
> effectively in it? Jargon, conventions, critical constraints, gotchas, external system
|
|
526
|
+
> behaviors?"
|
|
527
|
+
|
|
528
|
+
This becomes the domain knowledge section of the roleguide. It's where the product owner's expertise
|
|
529
|
+
lives — capture it fully.
|
|
530
|
+
|
|
531
|
+
**Mid-session scope change handling:** If the product owner gives an answer that contradicts or
|
|
532
|
+
substantially expands a prior answer, surface the conflict explicitly before continuing:
|
|
533
|
+
|
|
534
|
+
> "Earlier you said [X]. Now you're saying [Y] — these conflict. Should I replace the earlier
|
|
535
|
+
> answer with this one, merge them, or keep both as separate concerns?"
|
|
536
|
+
|
|
537
|
+
Only one canonical answer per question. Resolve contradictions before moving to the next question.
|
|
538
|
+
|
|
539
|
+
**Specificity gate (before proceeding to Step 3):** After all 8 answers are collected, summarize
|
|
540
|
+
them back to the product owner in a single compact block and require explicit confirmation:
|
|
541
|
+
|
|
542
|
+
\`\`\`
|
|
543
|
+
Here's what I've captured:
|
|
544
|
+
|
|
545
|
+
Team: <slug> — "<display name>"
|
|
546
|
+
Problem: <one sentence>
|
|
547
|
+
Outcomes: <concrete artifact or metric>
|
|
548
|
+
Scope: owns [X]; does NOT own [Y]
|
|
549
|
+
North star: <metric>, measured by <method>, baseline <N>, target <M>
|
|
550
|
+
Interfaces: <other teams>
|
|
551
|
+
Roster: Bar Raiser, Red Team, Security Reviewer, Dogfood Auditor + [domain agents]
|
|
552
|
+
Domain notes: <key gotchas or constraints>
|
|
553
|
+
|
|
554
|
+
Does this accurately capture your intent? I won't start drafting until you confirm.
|
|
555
|
+
\`\`\`
|
|
556
|
+
|
|
557
|
+
If the product owner corrects anything, update that answer and re-confirm the full summary before
|
|
558
|
+
drafting. Do not proceed to Step 3 without explicit approval of this summary.
|
|
559
|
+
|
|
560
|
+
---
|
|
561
|
+
|
|
562
|
+
### Step 3: DRAFT — Produce the roleguide
|
|
563
|
+
|
|
564
|
+
Using the answers from Step 2, draft the complete roleguide. Follow the mandatory sections
|
|
565
|
+
checklist below exactly. Write in second person ("You are the X team lead"). Be direct — the team
|
|
566
|
+
lead reads this every session.
|
|
567
|
+
|
|
568
|
+
Write section by section and share each with the product owner as you go, or draft the whole
|
|
569
|
+
roleguide and present it at once — let the product owner decide which flow they prefer.
|
|
570
|
+
|
|
571
|
+
**Target length: 400–800 lines.** If the domain is complex and requires more, move details to named
|
|
572
|
+
memories or appendices. Do not exceed 1500 lines.
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
576
|
+
**Draft checkpoint — save a scratch copy now.** After completing the draft text, write it to disk
|
|
577
|
+
immediately as a resilience checkpoint:
|
|
578
|
+
\`\`\`
|
|
579
|
+
mx-agent-system/roleguides/<team-slug>-leader.md ← scratch copy, not yet approved
|
|
580
|
+
\`\`\`
|
|
581
|
+
Add \`<!-- DRAFT — pending review — do not use until approved -->\` as the first line of the file.
|
|
582
|
+
This is NOT the final approved file — it is a crash-safety checkpoint so the work survives if
|
|
583
|
+
the session is interrupted before Step 4 review. The product owner review and final approval
|
|
584
|
+
happens in Step 4. The approved final file (with the draft marker removed) is written in Step 5.
|
|
585
|
+
|
|
586
|
+
---
|
|
587
|
+
|
|
588
|
+
### Step 4: REVIEW — Explicit approval before writing any files
|
|
589
|
+
|
|
590
|
+
Before writing the **approved final** file, present a summary to the product owner and get explicit sign-off:
|
|
591
|
+
|
|
592
|
+
\`\`\`
|
|
593
|
+
Here is what I'm about to create:
|
|
594
|
+
|
|
595
|
+
Team slug: <team-slug>
|
|
596
|
+
Display name: <display name>
|
|
597
|
+
Roleguide path: mx-agent-system/roleguides/<team-slug>-leader.md
|
|
598
|
+
Named memories: <team-slug>-leader-state, <team-slug>-iteration-log, <team-slug>-known-issues
|
|
599
|
+
North star: <metric name>
|
|
600
|
+
Roster size: <N agents>
|
|
601
|
+
|
|
602
|
+
Does this look correct? Shall I proceed?
|
|
603
|
+
\`\`\`
|
|
604
|
+
|
|
605
|
+
Wait for explicit "yes" or "proceed" before moving to Step 5. If the product owner wants changes,
|
|
606
|
+
make them now.
|
|
607
|
+
|
|
608
|
+
---
|
|
609
|
+
|
|
610
|
+
### Step 5: WRITE — Save the roleguide
|
|
611
|
+
|
|
612
|
+
Write the roleguide to:
|
|
613
|
+
\`\`\`
|
|
614
|
+
mx-agent-system/roleguides/<team-slug>-leader.md
|
|
615
|
+
\`\`\`
|
|
616
|
+
|
|
617
|
+
Also write the service catalog entry to:
|
|
618
|
+
\`\`\`
|
|
619
|
+
mx-agent-system/teams/<team-slug>.md
|
|
620
|
+
\`\`\`
|
|
621
|
+
|
|
622
|
+
The catalog entry MUST include: display name, roleguide path, owner (required — not "TBD"), named
|
|
623
|
+
memories, interfaces, and escalation routing. Do not leave owner or interfaces blank.
|
|
624
|
+
\`\`\`markdown
|
|
625
|
+
# Team: <team-slug>
|
|
626
|
+
|
|
627
|
+
Display name: <display name>
|
|
628
|
+
Roleguide: \`mx-agent-system/roleguides/<team-slug>-leader.md\`
|
|
629
|
+
Owner: <product owner>
|
|
630
|
+
|
|
631
|
+
## Named Memories (Source of Truth)
|
|
632
|
+
|
|
633
|
+
- \`<team-slug>-leader-state\`
|
|
634
|
+
- \`<team-slug>-iteration-log\`
|
|
635
|
+
- \`<team-slug>-known-issues\`
|
|
636
|
+
[plus any team-specific named memories]
|
|
637
|
+
|
|
638
|
+
Global routing queue (all teams):
|
|
639
|
+
- \`cross-team-escalations\`
|
|
640
|
+
|
|
641
|
+
## Interfaces / What This Team Owns
|
|
642
|
+
|
|
643
|
+
- [what the team owns, from Q4]
|
|
644
|
+
|
|
645
|
+
## Validation / Escalation Routing
|
|
646
|
+
|
|
647
|
+
To request validation from this team:
|
|
648
|
+
- Add a \`validation-request\` entry to \`cross-team-escalations\` with:
|
|
649
|
+
- \`Team = <team-slug>\`
|
|
650
|
+
- acceptance criteria + evidence plan
|
|
651
|
+
|
|
652
|
+
Definition of done for a fulfilled request:
|
|
653
|
+
- An outcome memory is created and the \`cross-team-escalations\` entry is updated with:
|
|
654
|
+
- \`outcome_recorded = yes\`
|
|
655
|
+
- \`outcome_memory_ref = <memory-id>\`
|
|
656
|
+
\`\`\`
|
|
657
|
+
|
|
658
|
+
---
|
|
659
|
+
|
|
660
|
+
### Step 6: PROVISION — Validate then run mx-agent create
|
|
661
|
+
|
|
662
|
+
**Read-back validation (do this before running mx-agent create):** Re-read the file you just wrote
|
|
663
|
+
and confirm:
|
|
664
|
+
1. The file is not empty or truncated
|
|
665
|
+
2. All mandatory sections from the checklist below are present in the written output
|
|
666
|
+
3. The team slug, display name, and north star metric match what the product owner approved
|
|
667
|
+
|
|
668
|
+
If anything is wrong, fix it now. Do not invoke \`mx-agent create\` against a file you have not
|
|
669
|
+
verified.
|
|
670
|
+
|
|
671
|
+
\`\`\`bash
|
|
672
|
+
mx-agent create \\
|
|
673
|
+
--roleguide mx-agent-system/roleguides/<team-slug>-leader.md \\
|
|
674
|
+
--name <team-slug>
|
|
675
|
+
\`\`\`
|
|
676
|
+
|
|
677
|
+
Confirm the command exits successfully. If it fails, diagnose the error, fix the roleguide if
|
|
678
|
+
needed, and re-run. Do not hand off until provisioning succeeds.
|
|
679
|
+
|
|
680
|
+
Also initialize the three mandatory named memories:
|
|
681
|
+
\`\`\`text
|
|
682
|
+
# Step 1 of 3: create leader-state and capture the conversation ID
|
|
683
|
+
create_memory({
|
|
684
|
+
name: "<team-slug>-leader-state",
|
|
685
|
+
conversationId: "NEW",
|
|
686
|
+
content: "## <Team Display Name> Leader State — initialized [timestamp]\\n\\n### Async Status Block\\n- Async status: ok\\n- Decision needed: none\\n- Linkage: none\\n\\nTeam provisioned. No iterations started yet.\\n\\n### Next Action\\n- Start first session: mx-agent start <team-slug>\\n- Read this roleguide fully before doing anything else\\n- Write this named memory with your actual current state immediately after reading the roleguide"
|
|
687
|
+
})
|
|
688
|
+
# Output includes new conversationId (e.g., conv_xyz)
|
|
689
|
+
# Capture that conversation ID — use it for the next two calls.
|
|
690
|
+
|
|
691
|
+
# Step 2 of 3: use the conversation ID from above (replace conv_xyz with the actual ID)
|
|
692
|
+
create_memory({
|
|
693
|
+
name: "<team-slug>-iteration-log",
|
|
694
|
+
conversationId: "conv_xyz",
|
|
695
|
+
content: "## <Team Display Name> Iteration Log — initialized [timestamp]\\n\\nNo iterations completed yet. Team provisioned on [date].\\n\\n| Iteration | Focus | North Star Before | North Star After | Status |\\n|---|---|---|---|---|\\n| (none yet) | | | | |"
|
|
696
|
+
})
|
|
697
|
+
|
|
698
|
+
# Step 3 of 3: same conversation ID
|
|
699
|
+
create_memory({
|
|
700
|
+
name: "<team-slug>-known-issues",
|
|
701
|
+
conversationId: "conv_xyz",
|
|
702
|
+
content: "## <Team Display Name> Known Issues — initialized [timestamp]\\n\\nNo known issues at provisioning time. First session will populate this."
|
|
703
|
+
})
|
|
704
|
+
\`\`\`
|
|
705
|
+
|
|
706
|
+
---
|
|
707
|
+
|
|
708
|
+
### Step 7: HANDOFF — Tell the product owner exactly what was created
|
|
709
|
+
|
|
710
|
+
Give the product owner this information explicitly:
|
|
711
|
+
|
|
712
|
+
\`\`\`
|
|
713
|
+
Team provisioned successfully.
|
|
714
|
+
|
|
715
|
+
Roleguide: mx-agent-system/roleguides/<team-slug>-leader.md
|
|
716
|
+
Catalog entry: mx-agent-system/teams/<team-slug>.md
|
|
717
|
+
Team slug: <team-slug>
|
|
718
|
+
|
|
719
|
+
Named memories initialized:
|
|
720
|
+
- <team-slug>-leader-state
|
|
721
|
+
- <team-slug>-iteration-log
|
|
722
|
+
- <team-slug>-known-issues
|
|
723
|
+
|
|
724
|
+
To start the team:
|
|
725
|
+
mx-agent start <team-slug>
|
|
726
|
+
|
|
727
|
+
Important — first session rule: the team lead MUST write <team-slug>-leader-state
|
|
728
|
+
immediately after reading the roleguide. This is what makes the team resumable.
|
|
729
|
+
Without it, the team cannot recover context across sessions.
|
|
730
|
+
|
|
731
|
+
Your job as product owner in the first session: confirm the team lead has read the
|
|
732
|
+
roleguide, selected a first iteration goal, and saved <team-slug>-leader-state.
|
|
733
|
+
\`\`\`
|
|
734
|
+
|
|
735
|
+
Your session is now complete.
|
|
736
|
+
|
|
737
|
+
---
|
|
738
|
+
|
|
739
|
+
## Mandatory Roleguide Sections Checklist
|
|
740
|
+
|
|
741
|
+
Every roleguide you produce MUST include ALL of these sections. Check each one before presenting
|
|
742
|
+
for review.
|
|
743
|
+
|
|
744
|
+
- [ ] **Role / Mission** — what the team is, written in second person ("You are the X team lead")
|
|
745
|
+
- [ ] **What This Team Owns** — explicit scope table
|
|
746
|
+
- [ ] **Non-Goals** — explicit list of what the team does NOT own, with who owns it instead
|
|
747
|
+
- [ ] **Goals** — north star metric (one primary, measurement method, baseline, target) + supporting
|
|
748
|
+
KPIs (secondary signals that move when the north star moves) + measurement cadence (how often
|
|
749
|
+
the north star is recalculated) + maintenance definition (what "sustaining current level"
|
|
750
|
+
looks like when the team is in maintenance mode)
|
|
751
|
+
- [ ] **The Continuous Improvement Loop** — all 8 steps:
|
|
752
|
+
- Step 0: VERIFY PREVIOUS ITERATION (gate check)
|
|
753
|
+
- Step 1: MEASURE (establish or refresh baseline)
|
|
754
|
+
- Step 2: GATHER FEEDBACK (active search, not passive waiting)
|
|
755
|
+
- Step 3: IDENTIFY GAP (prior art search required before this step)
|
|
756
|
+
- Step 4: PLAN (scope to ONE improvement)
|
|
757
|
+
- Step 5: IMPLEMENT (independent verification, security review gate)
|
|
758
|
+
- Step 6: VALIDATE (hard gate — real validation, not synthetic test)
|
|
759
|
+
- Step 7: MEASURE AGAIN (close the loop)
|
|
760
|
+
- Step 8: STATUS REPORT (dev-log file + named memory)
|
|
761
|
+
- [ ] **Start-of-Session Procedure** — exact sequence of MCP tool calls to run at the start of EVERY
|
|
762
|
+
session; MUST include \`get_memory({ name: "<team>-leader-state" })\` as the FIRST call (this
|
|
763
|
+
is what makes the team resumable); MUST include a check of \`cross-team-escalations\` for
|
|
764
|
+
pending items routed to this team
|
|
765
|
+
- [ ] **Step 0 Gate** — verify previous iteration is complete before starting a new one
|
|
766
|
+
- [ ] **Definition of "Shipped"** — what counts as done for this team specifically; MUST include
|
|
767
|
+
the dual-logging contract: (1) an outcome memory created in MemNexus, AND (2) a repo index
|
|
768
|
+
entry added to \`mx-agent-system/outcomes/\`; "shipped" is not declared until both exist
|
|
769
|
+
- [ ] **Prior Art Search** — mandatory before any gap selection or approach; must be documented
|
|
770
|
+
- [ ] **Mandatory Roles** (always active, every iteration):
|
|
771
|
+
- Bar Raiser — process adherence, blocks on missing mechanisms
|
|
772
|
+
- Red Team — adversarial challenge at Steps 3 and 6
|
|
773
|
+
- Security Reviewer — mandatory for code/config changes; Must Fix blocks PR (only product owner can override)
|
|
774
|
+
- Dogfood Auditor — MemNexus usage audit, product improvement pipeline
|
|
775
|
+
- [ ] **Agent Roster** — full table with agent number, specialty, and when to use; scaling guidance
|
|
776
|
+
- [ ] **Named Memory Anchors** — table with name, content, and update trigger for:
|
|
777
|
+
- \`<team>-leader-state\`
|
|
778
|
+
- \`<team>-iteration-log\`
|
|
779
|
+
- \`<team>-known-issues\`
|
|
780
|
+
- plus any team-specific named memories
|
|
781
|
+
- [ ] **Context Management / Leader State Checkpoint** — exact template for what \`<team>-leader-state\` contains and when to update it; template MUST include \`### Async Status Block\` section with \`Async status:\`, \`Decision needed:\`, and \`Linkage:\` fields
|
|
782
|
+
- [ ] **Decision Authority** — what the team lead can decide alone vs. what requires escalation to product owner
|
|
783
|
+
- [ ] **Key Files** — table of files the team owns and works with
|
|
784
|
+
- [ ] **How to Start a Session** — the specific sequence of MCP tool calls (not prose — tool calls)
|
|
785
|
+
- [ ] **Anti-Patterns** — what NOT to do, with the rule that prevents each anti-pattern
|
|
786
|
+
- [ ] **Interfaces** — which teams it interacts with, what it consumes and produces, escalation routing
|
|
787
|
+
|
|
788
|
+
---
|
|
789
|
+
|
|
790
|
+
## Tone and Style Guide for Drafts
|
|
791
|
+
|
|
792
|
+
**Voice:** Second person throughout. "You are the X team lead." "You measure." "You delegate."
|
|
793
|
+
|
|
794
|
+
**Directness:** The team lead reads this every session. No warm-up prose, no history lessons.
|
|
795
|
+
Every sentence must earn its place.
|
|
796
|
+
|
|
797
|
+
**Commands over prose:** When describing what to do, show the exact command. Not "search for prior
|
|
798
|
+
art" — show:
|
|
799
|
+
\`\`\`text
|
|
800
|
+
search_memories({ query: "[gap area]" })
|
|
801
|
+
search_memories({ query: "[proposed approach]", topics: ["decision"] })
|
|
802
|
+
\`\`\`
|
|
803
|
+
|
|
804
|
+
**Concrete examples:** Include example named memory content, example iteration log rows, example
|
|
805
|
+
status report formats. Worked examples reduce ambiguity.
|
|
806
|
+
|
|
807
|
+
**Tables for structure:** Use tables for rosters, decision authority, key files, named memory
|
|
808
|
+
anchors. Prose for narrative, tables for reference.
|
|
809
|
+
|
|
810
|
+
**Length discipline:** Target 400–800 lines. If you find yourself writing a third paragraph
|
|
811
|
+
explaining a concept, consider whether it should instead be a named memory the team saves once
|
|
812
|
+
and retrieves when needed.
|
|
813
|
+
|
|
814
|
+
**Avoid:**
|
|
815
|
+
- Passive voice ("this should be done")
|
|
816
|
+
- Hedging ("usually", "in most cases", "typically")
|
|
817
|
+
- Circular definitions ("the team improves things by improving them")
|
|
818
|
+
- Filler sections that repeat the CLAUDE.md memory rules verbatim — reference them, don't copy them
|
|
819
|
+
|
|
820
|
+
---
|
|
821
|
+
|
|
822
|
+
## Anti-Patterns for This Session
|
|
823
|
+
|
|
824
|
+
| Anti-Pattern | Rule |
|
|
825
|
+
|---|---|
|
|
826
|
+
| Asking all 8 elicitation questions at once | One question at a time. Confirm each answer before moving on. |
|
|
827
|
+
| Writing files before getting explicit approval | Step 4 review is mandatory. Never write to disk without "proceed". |
|
|
828
|
+
| Producing a roleguide missing mandatory sections | Check the mandatory sections checklist before presenting for review. |
|
|
829
|
+
| Creating a team whose scope overlaps significantly with an existing team | Read the catalog first. Flag overlap to the product owner and resolve it. |
|
|
830
|
+
| Provisioning without verifying \`mx-agent create\` succeeded | Confirm exit success. If it fails, fix and re-run before handing off. |
|
|
831
|
+
| Handing off without initializing the three named memories | The team is not resumable without \`<team>-leader-state\`. Initialize all three. |
|
|
832
|
+
| Writing a roleguide longer than 1500 lines | Move details to named memories or appendices. |
|
|
833
|
+
| Leaving the "definition of shipped" vague | "The team shipped X" must be testable. If it's not falsifiable, it's not a definition. |
|
|
834
|
+
| Omitting the north star metric measurement method | "Better quality" is not a metric. The product owner must say how it's measured and what the baseline is. |
|
|
835
|
+
| Asking the product owner to choose between roleguide structures or drafting approaches | Structural and drafting decisions are yours to make. Propose and confirm — don't ask the product owner to design the roleguide for you. |
|
|
836
|
+
| Marking the mandatory sections checklist as complete without reading each section in the produced draft | Work through the checklist item by item against the actual text you wrote. Assumption is not verification. |
|
|
837
|
+
| Resuming a new session without checking for an existing \`<!-- DRAFT — pending review -->\` file | At Step 1 ORIENT, check whether a draft file already exists for the intended team slug. If it does, resume from it rather than starting elicitation over. |
|
|
838
|
+
|
|
839
|
+
---
|
|
840
|
+
|
|
841
|
+
## Reference: What a Complete Provisioned Team Looks Like
|
|
842
|
+
|
|
843
|
+
After your session, the following must all exist:
|
|
844
|
+
|
|
845
|
+
| Artifact | Path / Name | Required |
|
|
846
|
+
|---|---|---|
|
|
847
|
+
| Roleguide | \`mx-agent-system/roleguides/<team-slug>-leader.md\` | Yes |
|
|
848
|
+
| Catalog entry | \`mx-agent-system/teams/<team-slug>.md\` | Yes |
|
|
849
|
+
| Leader state memory | \`<team-slug>-leader-state\` | Yes |
|
|
850
|
+
| Iteration log memory | \`<team-slug>-iteration-log\` | Yes |
|
|
851
|
+
| Known issues memory | \`<team-slug>-known-issues\` | Yes |
|
|
852
|
+
| mx-agent create confirmed | Exit 0 | Yes |
|
|
853
|
+
| Roleguide merged to main | PR merged to \`main\` branch | Yes |
|
|
854
|
+
| Worktree starts cleanly | \`mx-agent start <team-slug>\` exits without error | Yes |
|
|
855
|
+
|
|
856
|
+
The "team exists" only when all eight rows are Yes.
|
|
857
|
+
|
|
858
|
+
---
|
|
859
|
+
|
|
860
|
+
## Quick Reference: Elicitation Order
|
|
861
|
+
|
|
862
|
+
\`\`\`
|
|
863
|
+
Q1 Team slug + display name
|
|
864
|
+
Q2 Problem statement
|
|
865
|
+
Q3 User-visible outcomes
|
|
866
|
+
Q4 Scope (in + out)
|
|
867
|
+
Q5 North star metric (measurement + baseline + target)
|
|
868
|
+
Q6 Interfaces (other teams + external dependencies)
|
|
869
|
+
Q7 Agent roster (always include Bar Raiser, Red Team, Security Reviewer, Dogfood Auditor)
|
|
870
|
+
Q8 Domain-specific context (jargon, gotchas, constraints)
|
|
871
|
+
\`\`\`
|
|
872
|
+
|
|
873
|
+
One at a time. Confirm each. No exceptions.
|
|
874
|
+
`;
|
|
875
|
+
}
|
|
325
876
|
//# sourceMappingURL=templates.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAClD;IACE,KAAK,EAAE;QACL,UAAU,EAAE;YACV;gBACE,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;aACzE;SACF;KACF;IACD,WAAW,EAAE;QACX,KAA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I;SACd;QACD,eAAe,EAAE,KAAK;QACtB,eAAe,EAAE,YAAY;QAC7B,cAAc,EAAE,+EAA+E;QAC/F,MAAM,EAAE;YACN,UAAU,QAAQ,mDAAmD;YACrE,UAAU,QAAQ,uDAAuD;YACzE,UAAU,QAAQ,wDAAwD;SAC3E;QACD,cAAc,EAAE;YACd,MAAM,EAAE;gBACN,UAAU,EAAE,CAAC,uBAAuB,CAAC;gBACrC,QAAQ,EAAE;oBACR,qBAAqB,EAAE,IAAI;iBAC5B;aACF;SACF;QACD,iBAAiB,EAAE,8CAA8C;QACjE,gBAAgB,EAAE,6CAA6C;QAC/D,UAAU,EAAE,QAAQ;QACpB,mBAAmB,EAAE,IAAI;KAC1B,EACD,IAAI,EACJ,CAAC,CACF,GAAG,IAAI,CAAC;AACX,CAAC;AAED,MAAM,UAAU,8BAA8B,CAAC,WAAmB;IAChE,OAAO;;;;qBAIY,WAAW
|
|
1
|
+
{"version":3,"file":"templates.js","sourceRoot":"","sources":["../../src/lib/templates.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;;GAGG;AACH,MAAM,CAAC,MAAM,sBAAsB,GAAG,IAAI,CAAC,SAAS,CAClD;IACE,KAAK,EAAE;QACL,UAAU,EAAE;YACV;gBACE,OAAO,EAAE,MAAM;gBACf,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,iCAAiC,EAAE,CAAC;aACzE;SACF;KACF;IACD,WAAW,EAAE;QACX,KAAK,EAAE;YACL,MAAM;YACN,MAAM;YACN,MAAM;YACN,OAAO;YACP,MAAM;YACN,MAAM;YACN,UAAU;YACV,WAAW;YACX,MAAM;YACN,cAAc;SACf;QACD,IAAI,EAAE;YACJ,iBAAiB;YACjB,gBAAgB;YAChB,gBAAgB;YAChB,kBAAkB;YAClB,yBAAyB;YACzB,cAAc;YACd,eAAe;YACf,0BAA0B;YAC1B,uBAAuB;YACvB,wBAAwB;YACxB,yBAAyB;YACzB,2BAA2B;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;;;;;;;;CAohBR,CAAC;AACF,CAAC"}
|
package/package.json
CHANGED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-validation.test.d.ts","sourceRoot":"","sources":["../../src/__tests__/init-validation.test.ts"],"names":[],"mappings":""}
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { describe, it, expect } from 'vitest';
|
|
2
|
-
import { validateProjectConfig } from '../lib/project-config.js';
|
|
3
|
-
/**
|
|
4
|
-
* Tests for the init CLI option validation path (PLAT-032).
|
|
5
|
-
*
|
|
6
|
-
* The mx-agent init command builds a partial ProjectConfig from its CLI opts
|
|
7
|
-
* (--base-branch, --worktree-dir, --config-source) and passes them through
|
|
8
|
-
* validateProjectConfig() before writing mx-agent.config.json.
|
|
9
|
-
*
|
|
10
|
-
* These tests exercise validateProjectConfig() directly with the same values
|
|
11
|
-
* the CLI would pass, confirming that shell metacharacters and path traversal
|
|
12
|
-
* are rejected before any file is written.
|
|
13
|
-
*/
|
|
14
|
-
describe('init CLI option validation (PLAT-032)', () => {
|
|
15
|
-
it('rejects --base-branch value containing a shell metacharacter', () => {
|
|
16
|
-
const configFromOpts = { baseBranch: 'main; rm -rf /' };
|
|
17
|
-
expect(() => validateProjectConfig(configFromOpts)).toThrow(/disallowed characters/);
|
|
18
|
-
});
|
|
19
|
-
it('rejects --config-source value containing path traversal (..)', () => {
|
|
20
|
-
const configFromOpts = { configSource: '../../etc/passwd' };
|
|
21
|
-
expect(() => validateProjectConfig(configFromOpts)).toThrow(/path traversal/);
|
|
22
|
-
});
|
|
23
|
-
it('accepts valid CLI option values without throwing', () => {
|
|
24
|
-
const configFromOpts = {
|
|
25
|
-
baseBranch: 'feature/my-branch',
|
|
26
|
-
worktreeDir: '.worktrees',
|
|
27
|
-
configSource: 'mx-agent-system/agent-config',
|
|
28
|
-
};
|
|
29
|
-
expect(() => validateProjectConfig(configFromOpts)).not.toThrow();
|
|
30
|
-
});
|
|
31
|
-
});
|
|
32
|
-
//# sourceMappingURL=init-validation.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"init-validation.test.js","sourceRoot":"","sources":["../../src/__tests__/init-validation.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,qBAAqB,EAAE,MAAM,0BAA0B,CAAC;AAEjE;;;;;;;;;;GAUG;AAEH,QAAQ,CAAC,uCAAuC,EAAE,GAAG,EAAE;IACrD,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,cAAc,GAAG,EAAE,UAAU,EAAE,gBAAgB,EAAE,CAAC;QACxD,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,uBAAuB,CAAC,CAAC;IACvF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,8DAA8D,EAAE,GAAG,EAAE;QACtE,MAAM,cAAc,GAAG,EAAE,YAAY,EAAE,kBAAkB,EAAE,CAAC;QAC5D,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,OAAO,CAAC,gBAAgB,CAAC,CAAC;IAChF,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kDAAkD,EAAE,GAAG,EAAE;QAC1D,MAAM,cAAc,GAAG;YACrB,UAAU,EAAE,mBAAmB;YAC/B,WAAW,EAAE,YAAY;YACzB,YAAY,EAAE,8BAA8B;SAC7C,CAAC;QACF,MAAM,CAAC,GAAG,EAAE,CAAC,qBAAqB,CAAC,cAAc,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,EAAE,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|