qwen-base 1.0.0 → 1.0.2
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/bin/install.js +91 -143
- package/package.json +1 -1
- package/src/commands/audit-claude-md.md +7 -7
- package/src/commands/audit-claude.md +3 -3
- package/src/commands/orientation/tasks/task-seeding.md +2 -2
- package/src/framework/context/base-principles.md +1 -1
- package/src/framework/frameworks/claude-config-alignment.md +4 -4
- package/src/framework/frameworks/claudemd-strategy.md +13 -13
- package/src/framework/frameworks/satellite-registration.md +1 -1
- package/src/framework/tasks/audit-claude-md.md +18 -18
- package/src/framework/tasks/audit-claude.md +13 -13
- package/src/framework/tasks/scaffold.md +22 -22
- package/src/framework/tasks/surface-convert.md +2 -2
- package/src/framework/templates/claudemd-template.md +5 -5
- package/src/framework/utils/scan-claude-dirs.py +3 -3
- package/src/hooks/_template.py +1 -1
- package/src/hooks/psmm-injector.py +1 -1
- package/src/hooks/satellite-detection.py +1 -1
- package/src/skill/base.md +4 -4
- package/src/templates/workspace.json +1 -1
package/bin/install.js
CHANGED
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
const fs = require('fs');
|
|
4
4
|
const path = require('path');
|
|
5
5
|
const os = require('os');
|
|
6
|
+
const readline = require('readline');
|
|
6
7
|
|
|
7
|
-
// Colors
|
|
8
8
|
const green = '\x1b[32m';
|
|
9
9
|
const cyan = '\x1b[36m';
|
|
10
10
|
const yellow = '\x1b[33m';
|
|
@@ -14,12 +14,12 @@ const reset = '\x1b[0m';
|
|
|
14
14
|
const pkg = require('../package.json');
|
|
15
15
|
|
|
16
16
|
const banner = `
|
|
17
|
-
${green}
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
17
|
+
${green} \u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557\u2588\u2588\u2588\u2588\u2588\u2588\u2557
|
|
18
|
+
\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2557
|
|
19
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551
|
|
20
|
+
\u2588\u2588\u2554\u2550\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551\u2588\u2588\u2554\u2550\u2550\u2588\u2588\u2551
|
|
21
|
+
\u2588\u2588\u2588\u2588\u2588\u2588\u2554\u255d\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551\u2588\u2588\u2588\u2588\u2588\u2588\u2588\u2551
|
|
22
|
+
\u255a\u2550\u2550\u2550\u2550\u2550\u255d \u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u255d\u255a\u2550\u2550\u2550\u2550\u2550\u255d${reset}
|
|
23
23
|
|
|
24
24
|
BASE ${dim}v${pkg.version}${reset}
|
|
25
25
|
Builder's Automated State Engine
|
|
@@ -27,8 +27,10 @@ ${green} ██████╗ ███████╗███████╗
|
|
|
27
27
|
`;
|
|
28
28
|
|
|
29
29
|
const args = process.argv.slice(2);
|
|
30
|
-
const
|
|
30
|
+
const hasGlobal = args.includes('--global') || args.includes('-g');
|
|
31
31
|
const hasLocal = args.includes('--local') || args.includes('-l');
|
|
32
|
+
const hasHelp = args.includes('--help') || args.includes('-h');
|
|
33
|
+
const skipTools = args.includes('--skip-tools');
|
|
32
34
|
|
|
33
35
|
function parseConfigDirArg() {
|
|
34
36
|
const idx = args.findIndex(arg => arg === '--config-dir' || arg === '-c');
|
|
@@ -41,16 +43,14 @@ function parseConfigDirArg() {
|
|
|
41
43
|
return nextArg;
|
|
42
44
|
}
|
|
43
45
|
const configDirArg = args.find(arg => arg.startsWith('--config-dir=') || arg.startsWith('-c='));
|
|
44
|
-
if (configDirArg)
|
|
45
|
-
return configDirArg.split('=')[1];
|
|
46
|
-
}
|
|
46
|
+
if (configDirArg) return configDirArg.split('=')[1];
|
|
47
47
|
return null;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
const explicitConfigDir = parseConfigDirArg();
|
|
51
|
+
|
|
50
52
|
function expandTilde(filePath) {
|
|
51
|
-
if (filePath && filePath.startsWith('~/'))
|
|
52
|
-
return path.join(os.homedir(), filePath.slice(2));
|
|
53
|
-
}
|
|
53
|
+
if (filePath && filePath.startsWith('~/')) return path.join(os.homedir(), filePath.slice(2));
|
|
54
54
|
return filePath;
|
|
55
55
|
}
|
|
56
56
|
|
|
@@ -61,24 +61,17 @@ function copyDir(srcDir, destDir, skipDirs = []) {
|
|
|
61
61
|
if (skipDirs.includes(entry.name)) continue;
|
|
62
62
|
const srcPath = path.join(srcDir, entry.name);
|
|
63
63
|
const destPath = path.join(destDir, entry.name);
|
|
64
|
-
if (entry.isDirectory())
|
|
65
|
-
|
|
66
|
-
} else {
|
|
67
|
-
fs.copyFileSync(srcPath, destPath);
|
|
68
|
-
}
|
|
64
|
+
if (entry.isDirectory()) copyDir(srcPath, destPath, skipDirs);
|
|
65
|
+
else fs.copyFileSync(srcPath, destPath);
|
|
69
66
|
}
|
|
70
67
|
}
|
|
71
68
|
|
|
72
|
-
function countFiles(dir
|
|
69
|
+
function countFiles(dir) {
|
|
73
70
|
let count = 0;
|
|
74
71
|
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
75
72
|
for (const entry of entries) {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
count += countFiles(fullPath, ext);
|
|
79
|
-
} else if (!ext || entry.name.endsWith(ext)) {
|
|
80
|
-
count++;
|
|
81
|
-
}
|
|
73
|
+
if (entry.isDirectory()) count += countFiles(path.join(dir, entry.name));
|
|
74
|
+
else count++;
|
|
82
75
|
}
|
|
83
76
|
return count;
|
|
84
77
|
}
|
|
@@ -89,139 +82,94 @@ if (hasHelp) {
|
|
|
89
82
|
console.log(` ${yellow}Usage:${reset} npx qwen-base [options]
|
|
90
83
|
|
|
91
84
|
${yellow}Options:${reset}
|
|
92
|
-
${cyan}-
|
|
93
|
-
${cyan}-
|
|
94
|
-
${cyan}-
|
|
85
|
+
${cyan}-g, --global${reset} Install globally (to Qwen config directory)
|
|
86
|
+
${cyan}-l, --local${reset} Install locally (to ./.qwen/ in current directory)
|
|
87
|
+
${cyan}-c, --config-dir <path>${reset} Specify custom Qwen config directory
|
|
88
|
+
${cyan}--skip-tools${reset} Skip OSS analysis tool installation
|
|
89
|
+
${cyan}-h, --help${reset} Show this help message
|
|
95
90
|
|
|
96
91
|
${yellow}Examples:${reset}
|
|
97
|
-
${dim}# Install globally (
|
|
98
|
-
npx qwen-base
|
|
92
|
+
${dim}# Install globally (recommended)${reset}
|
|
93
|
+
npx qwen-base --global
|
|
99
94
|
|
|
100
95
|
${dim}# Install to current project only${reset}
|
|
101
96
|
npx qwen-base --local
|
|
102
97
|
|
|
103
98
|
${yellow}What gets installed:${reset}
|
|
104
|
-
${cyan}commands/qwen-base/${reset}
|
|
105
|
-
|
|
106
|
-
framework/ Tasks, templates, frameworks (11 commands)
|
|
107
|
-
commands/ Command definitions
|
|
108
|
-
hooks/ 7 Python hooks for workspace intelligence
|
|
109
|
-
templates/ operator.json, workspace.json templates
|
|
110
|
-
${cyan}.qwen/hooks/${reset} Python hooks registration
|
|
99
|
+
${cyan}commands/qwen-base/${reset} 11 slash commands
|
|
100
|
+
${cyan}base/ Framework (core, transform, domains, schemas, rules, tools)
|
|
111
101
|
`);
|
|
112
102
|
process.exit(0);
|
|
113
103
|
}
|
|
114
104
|
|
|
115
|
-
|
|
116
|
-
const
|
|
117
|
-
const
|
|
118
|
-
const
|
|
119
|
-
const
|
|
120
|
-
|
|
121
|
-
const
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
const src = path.join(__dirname, '..');
|
|
134
|
-
|
|
135
|
-
// Copy entry point
|
|
136
|
-
fs.mkdirSync(baseDest, { recursive: true });
|
|
137
|
-
fs.copyFileSync(path.join(src, 'src', 'skill', 'base.md'), path.join(baseDest, 'base.md'));
|
|
138
|
-
console.log(` ${green}+${reset} base.md ${dim}(entry point)${reset}`);
|
|
139
|
-
|
|
140
|
-
// Copy framework
|
|
141
|
-
const fwSrc = path.join(src, 'src', 'framework');
|
|
142
|
-
const fwDest = path.join(baseDest, 'framework');
|
|
143
|
-
copyDir(fwSrc, fwDest);
|
|
144
|
-
const fwCount = countFiles(fwSrc);
|
|
145
|
-
console.log(` ${green}+${reset} framework/ ${dim}(${fwCount} files)${reset}`);
|
|
146
|
-
|
|
147
|
-
// Copy commands
|
|
148
|
-
const cmdSrc = path.join(src, 'src', 'commands');
|
|
149
|
-
const cmdDest = path.join(baseDest, 'commands');
|
|
150
|
-
copyDir(cmdSrc, cmdDest);
|
|
151
|
-
const cmdCount = countFiles(cmdSrc);
|
|
152
|
-
console.log(` ${green}+${reset} commands/ ${dim}(${cmdCount} files)${reset}`);
|
|
153
|
-
|
|
154
|
-
// Copy hooks
|
|
155
|
-
const hooksSrc = path.join(src, 'src', 'hooks');
|
|
156
|
-
const hooksDest = path.join(baseDest, 'hooks');
|
|
157
|
-
copyDir(hooksSrc, hooksDest);
|
|
158
|
-
const hookCount = countFiles(hooksSrc);
|
|
159
|
-
console.log(` ${green}+${reset} hooks/ ${dim}(${hookCount} Python hooks)${reset}`);
|
|
160
|
-
|
|
161
|
-
// Copy templates
|
|
162
|
-
const tplSrc = path.join(src, 'src', 'templates');
|
|
163
|
-
const tplDest = path.join(baseDest, 'templates');
|
|
164
|
-
copyDir(tplSrc, tplDest);
|
|
165
|
-
console.log(` ${green}+${reset} templates/ ${dim}(workspace templates)${reset}`);
|
|
166
|
-
|
|
167
|
-
// Copy MCP server
|
|
168
|
-
const mcpSrc = path.join(src, 'src', 'packages', 'base-mcp');
|
|
169
|
-
if (fs.existsSync(mcpSrc)) {
|
|
170
|
-
const mcpDest = path.join(qwenDir, 'base-mcp');
|
|
171
|
-
copyDir(mcpSrc, mcpDest);
|
|
172
|
-
console.log(` ${green}+${reset} base-mcp/ ${dim}(MCP server)${reset}`);
|
|
173
|
-
|
|
174
|
-
// Install MCP deps
|
|
175
|
-
try {
|
|
176
|
-
require('child_process').execSync('npm install --production --silent', {
|
|
177
|
-
cwd: mcpDest, stdio: 'pipe'
|
|
178
|
-
});
|
|
179
|
-
console.log(` ${green}+${reset} MCP dependencies installed${reset}`);
|
|
180
|
-
} catch (e) {
|
|
181
|
-
console.log(` ${yellow}!${reset} MCP deps install failed — run cd ${mcpDest} && npm install${reset}`);
|
|
105
|
+
function install(isGlobal) {
|
|
106
|
+
const src = path.join(__dirname, '..');
|
|
107
|
+
const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.QWEN_CONFIG_DIR);
|
|
108
|
+
const globalDir = configDir || path.join(os.homedir(), '.qwen');
|
|
109
|
+
const qwenDir = isGlobal ? globalDir : path.join(process.cwd(), '.qwen');
|
|
110
|
+
const aegisDest = path.join(qwenDir, 'aegis');
|
|
111
|
+
const cmdsDest = path.join(qwenDir, 'commands', 'qwen-base');
|
|
112
|
+
|
|
113
|
+
const locationLabel = isGlobal
|
|
114
|
+
? qwenDir.replace(os.homedir(), '~')
|
|
115
|
+
: qwenDir.replace(process.cwd(), '.');
|
|
116
|
+
|
|
117
|
+
if (fs.existsSync(aegisDest) || fs.existsSync(cmdsDest)) {
|
|
118
|
+
console.log(` ${yellow}Existing installation found at ${locationLabel}${reset}`);
|
|
119
|
+
console.log(` Updating...`);
|
|
120
|
+
if (fs.existsSync(aegisDest)) fs.rmSync(aegisDest, { recursive: true, force: true });
|
|
121
|
+
if (fs.existsSync(cmdsDest)) fs.rmSync(cmdsDest, { recursive: true, force: true });
|
|
182
122
|
}
|
|
183
|
-
}
|
|
184
123
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
124
|
+
console.log(` Installing to ${cyan}${locationLabel}${reset}\n`);
|
|
125
|
+
|
|
126
|
+
// Copy framework (note: BASE uses 'src/' structure)
|
|
127
|
+
if (fs.existsSync(path.join(src, 'src'))) {
|
|
128
|
+
copyDir(path.join(src, 'src'), path.join(qwenDir, 'base'));
|
|
129
|
+
console.log(` ${green}+${reset} base/ ${dim}(${countFiles(path.join(qwenDir, 'base'))} framework files)${reset}`);
|
|
191
130
|
}
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
const hookCommand = `python3 ${hookPath}`;
|
|
199
|
-
|
|
200
|
-
// Determine which event
|
|
201
|
-
let eventName = 'SessionStart';
|
|
202
|
-
if (hookFile === 'active-hook.py') eventName = 'SessionStart';
|
|
203
|
-
else if (hookFile === 'psmm-injector.py') eventName = 'SessionStart';
|
|
204
|
-
else if (hookFile === 'backlog-hook.py') eventName = 'SessionStart';
|
|
205
|
-
else if (hookFile === 'operator.py') eventName = 'SessionStart';
|
|
206
|
-
else if (hookFile === 'satellite-detection.py') eventName = 'SessionStart';
|
|
207
|
-
else if (hookFile === 'apex-insights.py') eventName = 'Stop';
|
|
208
|
-
else if (hookFile === 'base-pulse-check.py') eventName = 'SessionStart';
|
|
209
|
-
|
|
210
|
-
if (!settings.hooks[eventName]) settings.hooks[eventName] = [];
|
|
211
|
-
const exists = settings.hooks[eventName].some(h =>
|
|
212
|
-
(h.command && h.command.includes(hookFile)) ||
|
|
213
|
-
(h.hooks && h.hooks.some(i => i.command && i.command.includes(hookFile)))
|
|
214
|
-
);
|
|
215
|
-
if (!exists) {
|
|
216
|
-
settings.hooks[eventName].push({ hooks: [{ type: 'command', command: hookCommand }] });
|
|
217
|
-
}
|
|
131
|
+
|
|
132
|
+
// Copy commands
|
|
133
|
+
if (fs.existsSync(path.join(src, 'src', 'commands'))) {
|
|
134
|
+
fs.mkdirSync(cmdsDest, { recursive: true });
|
|
135
|
+
copyDir(path.join(src, 'src', 'commands'), cmdsDest);
|
|
136
|
+
console.log(` ${green}+${reset} commands/qwen-base/ ${dim}(${countFiles(cmdsDest)} commands)${reset}`);
|
|
218
137
|
}
|
|
219
|
-
|
|
138
|
+
|
|
139
|
+
console.log(`
|
|
140
|
+
${green}Done!${reset} Open Qwen Code and type ${cyan}/base${reset} to start.
|
|
141
|
+
`);
|
|
220
142
|
}
|
|
221
143
|
|
|
222
|
-
|
|
223
|
-
|
|
144
|
+
function promptLocation() {
|
|
145
|
+
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
224
146
|
|
|
225
|
-
|
|
226
|
-
|
|
147
|
+
const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.QWEN_CONFIG_DIR);
|
|
148
|
+
const globalPath = configDir || path.join(os.homedir(), '.qwen');
|
|
149
|
+
const globalLabel = globalPath.replace(os.homedir(), '~');
|
|
150
|
+
|
|
151
|
+
console.log(` ${yellow}Where would you like to install?${reset}
|
|
152
|
+
|
|
153
|
+
${cyan}1${reset}) Global ${dim}(${globalLabel})${reset} - available in all projects
|
|
154
|
+
${cyan}2${reset}) Local ${dim}(./.qwen)${reset} - this project only
|
|
227
155
|
`);
|
|
156
|
+
|
|
157
|
+
rl.question(` Choice ${dim}[1]${reset}: `, (answer) => {
|
|
158
|
+
rl.close();
|
|
159
|
+
install(answer.trim() !== '2');
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
if (hasGlobal && hasLocal) {
|
|
164
|
+
console.error(` ${yellow}Cannot specify both --global and --local${reset}`);
|
|
165
|
+
process.exit(1);
|
|
166
|
+
} else if (explicitConfigDir && hasLocal) {
|
|
167
|
+
console.error(` ${yellow}Cannot use --config-dir with --local${reset}`);
|
|
168
|
+
process.exit(1);
|
|
169
|
+
} else if (hasGlobal) {
|
|
170
|
+
install(true);
|
|
171
|
+
} else if (hasLocal) {
|
|
172
|
+
install(false);
|
|
173
|
+
} else {
|
|
174
|
+
promptLocation();
|
|
175
|
+
}
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: base:audit-claude-md
|
|
3
|
-
description: Audit
|
|
3
|
+
description: Audit QWEN.md against the QWEN.md Strategy and generate a compliant version
|
|
4
4
|
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash]
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
<objective>
|
|
8
|
-
Audit the project's
|
|
8
|
+
Audit the project's QWEN.md for strategy compliance, interactively rewrite it section by section, and route operational rules to CARL or an artifact.
|
|
9
9
|
|
|
10
|
-
**When to use:** "audit claude md", "check my
|
|
10
|
+
**When to use:** "audit claude md", "check my QWEN.md", "rewrite my QWEN.md", after major workspace changes.
|
|
11
11
|
</objective>
|
|
12
12
|
|
|
13
13
|
<execution_context>
|
|
@@ -19,18 +19,18 @@ Audit the project's CLAUDE.md for strategy compliance, interactively rewrite it
|
|
|
19
19
|
<context>
|
|
20
20
|
$ARGUMENTS
|
|
21
21
|
|
|
22
|
-
@
|
|
22
|
+
@QWEN.md
|
|
23
23
|
</context>
|
|
24
24
|
|
|
25
25
|
<process>
|
|
26
26
|
Follow task: @{~/.qwen/commands/qwen-base/tasks/audit-claude-md.md}
|
|
27
27
|
|
|
28
28
|
Key gates (do NOT skip):
|
|
29
|
-
1. Load strategy + template BEFORE reading user's
|
|
29
|
+
1. Load strategy + template BEFORE reading user's QWEN.md
|
|
30
30
|
2. Present full audit classification — wait for user approval
|
|
31
31
|
3. Detect CARL — wait for user decision on rule routing
|
|
32
32
|
4. Propose each section individually — wait for approval per section
|
|
33
|
-
5. Write to CLAUDE.base.md (never overwrite
|
|
33
|
+
5. Write to CLAUDE.base.md (never overwrite QWEN.md)
|
|
34
34
|
</process>
|
|
35
35
|
|
|
36
36
|
<success_criteria>
|
|
@@ -40,5 +40,5 @@ Key gates (do NOT skip):
|
|
|
40
40
|
- [ ] CARL detection completed, rule routing decided
|
|
41
41
|
- [ ] Each section approved individually
|
|
42
42
|
- [ ] Final CLAUDE.base.md under 100 lines
|
|
43
|
-
- [ ] Original
|
|
43
|
+
- [ ] Original QWEN.md untouched
|
|
44
44
|
</success_criteria>
|
|
@@ -11,8 +11,8 @@ Audit all .qwen/ directories in this workspace. Discover sprawl, classify items
|
|
|
11
11
|
</objective>
|
|
12
12
|
|
|
13
13
|
<execution_context>
|
|
14
|
-
@base
|
|
15
|
-
@base
|
|
14
|
+
@{~/.qwen/commands/qwen-base/framework/}tasks/audit-QWEN.md
|
|
15
|
+
@{~/.qwen/commands/qwen-base/framework/}frameworks/qwen-config-alignment.md
|
|
16
16
|
</execution_context>
|
|
17
17
|
|
|
18
18
|
<context>
|
|
@@ -23,7 +23,7 @@ Workspace root config: .qwen/
|
|
|
23
23
|
</context>
|
|
24
24
|
|
|
25
25
|
<process>
|
|
26
|
-
Follow task: @base
|
|
26
|
+
Follow task: @{~/.qwen/commands/qwen-base/framework/}tasks/audit-QWEN.md
|
|
27
27
|
|
|
28
28
|
The framework file defines classification rules, safety protocol, and output format.
|
|
29
29
|
The task file defines the step-by-step process.
|
|
@@ -15,7 +15,7 @@ As an operator with aligned initiatives and projects, I want to capture the imme
|
|
|
15
15
|
<steps>
|
|
16
16
|
|
|
17
17
|
<step name="frame_and_filter" priority="first">
|
|
18
|
-
> Tasks are YOUR accountability items — things that must get done. Not
|
|
18
|
+
> Tasks are YOUR accountability items — things that must get done. Not Qwen Code todos. Not aspirational ideas. Concrete next actions.
|
|
19
19
|
>
|
|
20
20
|
> We'll go initiative by initiative, project by project. For each project, I'll show you the current status and ask: "What must get done next?"
|
|
21
21
|
>
|
|
@@ -89,5 +89,5 @@ Tasks created in Apex via MCP under their parent projects. Operator's immediate
|
|
|
89
89
|
- [ ] Tasks created via base_add_project(type="task") with correct parent_id
|
|
90
90
|
- [ ] Operator could skip projects freely
|
|
91
91
|
- [ ] Summary displayed with total counts
|
|
92
|
-
- [ ] NEVER treated tasks as
|
|
92
|
+
- [ ] NEVER treated tasks as Qwen Code internal todos
|
|
93
93
|
</acceptance-criteria>
|
|
@@ -60,7 +60,7 @@ BACKLOG (status=backlog in projects.json)
|
|
|
60
60
|
BASE scaffold operates in two modes:
|
|
61
61
|
|
|
62
62
|
- **Standard** (`/base:scaffold`) — Data layer only. Creates `.base/` with workspace.json, `.base/data/state.json`, ROADMAP.md. Scans and tracks what exists. Framework-agnostic.
|
|
63
|
-
- **Full** (`/base:scaffold --full`) — Data layer + projects.json + entities.json. Offers
|
|
63
|
+
- **Full** (`/base:scaffold --full`) — Data layer + projects.json + entities.json. Offers QWEN.md audit. The "batteries included" version for AI builders who want the full system.
|
|
64
64
|
|
|
65
65
|
Standard mode works for any workspace. Full mode provides Chris's proven operational structure.
|
|
66
66
|
|
|
@@ -11,7 +11,7 @@ Designed to be composed into any audit workflow that touches the system layer. T
|
|
|
11
11
|
- During initial BASE setup on an existing workspace (lots of legacy `.qwen/` dirs)
|
|
12
12
|
- As part of periodic workspace audits
|
|
13
13
|
- After installing a new tool/skill globally and wanting to clean up project-level copies
|
|
14
|
-
- When the user suspects their
|
|
14
|
+
- When the user suspects their Qwen Code config is fragmented
|
|
15
15
|
|
|
16
16
|
---
|
|
17
17
|
|
|
@@ -125,7 +125,7 @@ An item is PROJECT_SPECIFIC if:
|
|
|
125
125
|
An item is STALE if:
|
|
126
126
|
- settings.json references MCP servers that aren't in the current `.mcp.json` or global config
|
|
127
127
|
- hooks reference scripts or tools that have been renamed or removed
|
|
128
|
-
- Settings use old configuration patterns that
|
|
128
|
+
- Settings use old configuration patterns that Qwen Code no longer supports
|
|
129
129
|
- The `.qwen/` directory hasn't been modified in 60+ days AND the project itself shows no recent activity
|
|
130
130
|
|
|
131
131
|
**Present specific evidence of staleness. Never assume — prove it.**
|
|
@@ -168,7 +168,7 @@ Project-level `settings.json` and `settings.local.json` require special handling
|
|
|
168
168
|
|
|
169
169
|
## Remediation Safety Protocol
|
|
170
170
|
|
|
171
|
-
This is the most important section. `.qwen/` configuration is what makes
|
|
171
|
+
This is the most important section. `.qwen/` configuration is what makes Qwen Code work. A broken config means a broken development environment. Every remediation action must follow these rules:
|
|
172
172
|
|
|
173
173
|
### Before any change
|
|
174
174
|
1. **Explain what will change and why** — No "cleaning up your config." Say exactly: "Removing `apps/casegate-v2/.qwen/hooks/carl-hook.py` because an identical version runs globally from `~/.qwen/hooks/dynamic-rules-loader.py`. The global hook already fires on every prompt in every project."
|
|
@@ -182,7 +182,7 @@ This is the most important section. `.qwen/` configuration is what makes Claude
|
|
|
182
182
|
|
|
183
183
|
### After all changes
|
|
184
184
|
7. **Summary report** — What was changed, what was kept, what needs manual follow-up
|
|
185
|
-
8. **Recommend a test** — "Open
|
|
185
|
+
8. **Recommend a test** — "Open Qwen Code in {project} and verify hooks fire correctly"
|
|
186
186
|
|
|
187
187
|
### What this workflow NEVER does
|
|
188
188
|
- Modify `~/.qwen/` (global config) without explicit promotion approval
|
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
# The
|
|
1
|
+
# The QWEN.md Strategy
|
|
2
2
|
|
|
3
|
-
Composable framework for auditing and writing high-performance
|
|
3
|
+
Composable framework for auditing and writing high-performance QWEN.md files. Source of truth for the `/base:audit-claude-md` workflow.
|
|
4
4
|
|
|
5
5
|
---
|
|
6
6
|
|
|
7
7
|
## The Structure: What, Why, Who, Where, How
|
|
8
8
|
|
|
9
|
-
Every
|
|
9
|
+
Every QWEN.md follows five sections in this exact order. Each section answers one question. Together they give Claude complete operating context without bloat.
|
|
10
10
|
|
|
11
11
|
### What
|
|
12
12
|
What this document is and what this workspace contains.
|
|
13
13
|
|
|
14
14
|
One line. Sets the contract. Claude knows this is its instruction set.
|
|
15
15
|
|
|
16
|
-
> "This file provides guidance to
|
|
16
|
+
> "This file provides guidance to Qwen Code when working with code in this repository."
|
|
17
17
|
|
|
18
18
|
### Why
|
|
19
19
|
The philosophy. Identity context. Why this workspace exists.
|
|
20
20
|
|
|
21
|
-
This is where you separate identity from operations.
|
|
21
|
+
This is where you separate identity from operations. QWEN.md answers the "who am I working with?" question. Operational details (how to run a specific project, current sprint status) live elsewhere and get referenced with `@` pointers.
|
|
22
22
|
|
|
23
23
|
### Who
|
|
24
24
|
Business context. Who the user is, what they do, what matters to them.
|
|
@@ -81,14 +81,14 @@ It's a binary check. Claude can look at its own output and ask: "Did I do the fo
|
|
|
81
81
|
|
|
82
82
|
## The @ Reference System
|
|
83
83
|
|
|
84
|
-
|
|
84
|
+
QWEN.md stays lean by pointing to other files instead of inlining their content.
|
|
85
85
|
|
|
86
86
|
```
|
|
87
87
|
@LINKS.md — Personal branding URLs
|
|
88
88
|
@projects/dashboard-build/PLANNING.md — Active project context
|
|
89
89
|
```
|
|
90
90
|
|
|
91
|
-
Claude reads `@`-referenced files on demand. Your
|
|
91
|
+
Claude reads `@`-referenced files on demand. Your QWEN.md stays lean while still giving Claude access to deep context.
|
|
92
92
|
|
|
93
93
|
**What to inline vs what to reference:**
|
|
94
94
|
- **Inline:** Identity (who, what, why), workspace structure, rules, quick references
|
|
@@ -98,9 +98,9 @@ Claude reads `@`-referenced files on demand. Your CLAUDE.md stays lean while sti
|
|
|
98
98
|
|
|
99
99
|
## What Stays Out
|
|
100
100
|
|
|
101
|
-
The test: **if it changes every week, it doesn't belong in
|
|
101
|
+
The test: **if it changes every week, it doesn't belong in QWEN.md.**
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
QWEN.md is the constitution, not the daily newspaper.
|
|
104
104
|
|
|
105
105
|
| Doesn't belong | Where it goes |
|
|
106
106
|
|----------------|---------------|
|
|
@@ -116,7 +116,7 @@ CLAUDE.md is the constitution, not the daily newspaper.
|
|
|
116
116
|
|
|
117
117
|
Target: **under 100 lines.** This is a routing document, not a knowledge base.
|
|
118
118
|
|
|
119
|
-
If your
|
|
119
|
+
If your QWEN.md is over 100 lines, content is being inlined that should be referenced or removed. Common offenders:
|
|
120
120
|
- Inline system/framework descriptions (replace with a compact table)
|
|
121
121
|
- Redundant location tables when a tree diagram already exists
|
|
122
122
|
- Documentation system descriptions (the tree covers this)
|
|
@@ -126,7 +126,7 @@ If your CLAUDE.md is over 100 lines, content is being inlined that should be ref
|
|
|
126
126
|
|
|
127
127
|
## Audit Criteria
|
|
128
128
|
|
|
129
|
-
When auditing an existing
|
|
129
|
+
When auditing an existing QWEN.md, check:
|
|
130
130
|
|
|
131
131
|
### Structure
|
|
132
132
|
- [ ] Follows What → Why → Who → Where → How order
|
|
@@ -154,5 +154,5 @@ When auditing an existing CLAUDE.md, check:
|
|
|
154
154
|
|
|
155
155
|
### CARL Integration (if present)
|
|
156
156
|
- [ ] Operational rules that belong in domain-specific contexts are flagged for CARL migration
|
|
157
|
-
- [ ]
|
|
158
|
-
- [ ] No duplication between
|
|
157
|
+
- [ ] QWEN.md rules are constitutional (identity-level), not operational
|
|
158
|
+
- [ ] No duplication between QWEN.md rules and CARL domain rules
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What Are Satellites
|
|
4
4
|
|
|
5
|
-
Satellites are projects that live in their own git repos inside the workspace (e.g., `apps/*`). They run their own
|
|
5
|
+
Satellites are projects that live in their own git repos inside the workspace (e.g., `apps/*`). They run their own Qwen Code sessions independently. BASE needs visibility into them without owning them.
|
|
6
6
|
|
|
7
7
|
## Registration Flow
|
|
8
8
|
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Audit an existing
|
|
2
|
+
Audit an existing QWEN.md against the QWEN.md Strategy framework, then interactively rewrite it with user approval at each stage. Detects CARL installation and routes operational rules accordingly.
|
|
3
3
|
</purpose>
|
|
4
4
|
|
|
5
5
|
<user-story>
|
|
6
|
-
As an AI builder, I want my
|
|
6
|
+
As an AI builder, I want my QWEN.md audited against a proven strategy so I get a compliant, lean configuration file — with operational rules properly routed to CARL or preserved as an artifact for later.
|
|
7
7
|
</user-story>
|
|
8
8
|
|
|
9
9
|
<when-to-use>
|
|
10
10
|
- During /base:scaffold (optional step)
|
|
11
|
-
- When user says "audit my
|
|
11
|
+
- When user says "audit my QWEN.md", "improve my QWEN.md", "rewrite my QWEN.md"
|
|
12
12
|
- Entry point: /base:audit-claude-md
|
|
13
13
|
</when-to-use>
|
|
14
14
|
|
|
@@ -20,7 +20,7 @@ As an AI builder, I want my CLAUDE.md audited against a proven strategy so I get
|
|
|
20
20
|
<steps>
|
|
21
21
|
|
|
22
22
|
<step name="load_strategy" priority="first">
|
|
23
|
-
Load the
|
|
23
|
+
Load the QWEN.md Strategy framework and template.
|
|
24
24
|
|
|
25
25
|
1. Read `@{~/.qwen/commands/qwen-base/frameworks/claudemd-strategy.md}` — this is the source of truth
|
|
26
26
|
2. Read `@{~/.qwen/commands/qwen-base/templates/claudemd-template.md}` — this is the structural reference
|
|
@@ -30,15 +30,15 @@ You MUST understand the full strategy before reading the user's file. The strate
|
|
|
30
30
|
</step>
|
|
31
31
|
|
|
32
32
|
<step name="read_and_catalog">
|
|
33
|
-
Read the user's existing
|
|
33
|
+
Read the user's existing QWEN.md and catalog every piece of content.
|
|
34
34
|
|
|
35
|
-
1. Read `
|
|
36
|
-
2. If no
|
|
35
|
+
1. Read `QWEN.md` from workspace root
|
|
36
|
+
2. If no QWEN.md exists → skip to `generate_fresh` step
|
|
37
37
|
3. For every section, paragraph, rule, table, and reference in the file, classify each as:
|
|
38
|
-
- **KEEP** — belongs in
|
|
38
|
+
- **KEEP** — belongs in QWEN.md per the strategy (identity, structure, constitutional rules)
|
|
39
39
|
- **REMOVE** — doesn't belong (volatile data, task lists, state references, redundant sections)
|
|
40
40
|
- **RESTRUCTURE** — right content, wrong location or format (e.g., rule using "always" instead of NEVER pattern, operational content in wrong section)
|
|
41
|
-
- **CARL_CANDIDATE** — operational rule or domain-specific behavior that belongs in a rules engine, not
|
|
41
|
+
- **CARL_CANDIDATE** — operational rule or domain-specific behavior that belongs in a rules engine, not QWEN.md
|
|
42
42
|
|
|
43
43
|
4. Count total lines. Note if over 100-line budget.
|
|
44
44
|
</step>
|
|
@@ -92,7 +92,7 @@ Wait for user decision before proceeding.
|
|
|
92
92
|
</step>
|
|
93
93
|
|
|
94
94
|
<step name="propose_rewrite">
|
|
95
|
-
Build the new
|
|
95
|
+
Build the new QWEN.md section by section, presenting each for approval.
|
|
96
96
|
|
|
97
97
|
For EACH section (What, Why, Who, Where, How):
|
|
98
98
|
|
|
@@ -136,36 +136,36 @@ Handle operational rules that were classified as CARL_CANDIDATE.
|
|
|
136
136
|
</step>
|
|
137
137
|
|
|
138
138
|
<step name="write_and_finalize">
|
|
139
|
-
Write the approved
|
|
139
|
+
Write the approved QWEN.md.
|
|
140
140
|
|
|
141
141
|
1. Assemble all approved sections into final document
|
|
142
142
|
2. Verify line count (warn if over 100)
|
|
143
|
-
3. Write to `CLAUDE.base.md` in workspace root (NEVER overwrite
|
|
143
|
+
3. Write to `CLAUDE.base.md` in workspace root (NEVER overwrite QWEN.md directly)
|
|
144
144
|
4. Present final diff summary: sections added, removed, restructured, rules routed
|
|
145
145
|
|
|
146
146
|
Tell user:
|
|
147
|
-
- "Review `CLAUDE.base.md`. To adopt it: `mv CLAUDE.base.md
|
|
148
|
-
- "Your original
|
|
147
|
+
- "Review `CLAUDE.base.md`. To adopt it: `mv CLAUDE.base.md QWEN.md`"
|
|
148
|
+
- "Your original QWEN.md is untouched."
|
|
149
149
|
- If CARL candidates were routed: "Operational rules are in {location}."
|
|
150
150
|
</step>
|
|
151
151
|
|
|
152
152
|
</steps>
|
|
153
153
|
|
|
154
154
|
<output>
|
|
155
|
-
- `CLAUDE.base.md` — strategy-compliant
|
|
155
|
+
- `CLAUDE.base.md` — strategy-compliant QWEN.md ready for adoption
|
|
156
156
|
- CARL domain rules (if CARL installed) or `.base/artifacts/claudemd-audit-rules.md` (if not)
|
|
157
|
-
- Original
|
|
157
|
+
- Original QWEN.md untouched
|
|
158
158
|
</output>
|
|
159
159
|
|
|
160
160
|
<acceptance-criteria>
|
|
161
161
|
- [ ] Strategy framework loaded and understood before audit begins
|
|
162
|
-
- [ ] Every line of existing
|
|
162
|
+
- [ ] Every line of existing QWEN.md classified (KEEP/REMOVE/RESTRUCTURE/CARL_CANDIDATE)
|
|
163
163
|
- [ ] Full audit presented to user with approval gate before rewriting
|
|
164
164
|
- [ ] CARL installation detected and rule routing decided with user
|
|
165
165
|
- [ ] Each section proposed individually with user approval
|
|
166
166
|
- [ ] All rules use NEVER pattern
|
|
167
167
|
- [ ] Final output under 100 lines
|
|
168
168
|
- [ ] Operational rules routed to CARL or saved as artifact
|
|
169
|
-
- [ ] Original
|
|
169
|
+
- [ ] Original QWEN.md never modified
|
|
170
170
|
- [ ] User informed of how to adopt and next steps
|
|
171
171
|
</acceptance-criteria>
|
|
@@ -3,7 +3,7 @@ Audit all .qwen/ directories across a workspace. Discover sprawl, classify each
|
|
|
3
3
|
</purpose>
|
|
4
4
|
|
|
5
5
|
<user-story>
|
|
6
|
-
As an AI builder with multiple projects in my workspace, I want all my .qwen/ directories audited for duplication, staleness, and misplacement, so that my
|
|
6
|
+
As an AI builder with multiple projects in my workspace, I want all my .qwen/ directories audited for duplication, staleness, and misplacement, so that my Qwen Code configuration is clean, consistent, and I know exactly what's project-specific vs what should be global.
|
|
7
7
|
</user-story>
|
|
8
8
|
|
|
9
9
|
<when-to-use>
|
|
@@ -15,11 +15,11 @@ As an AI builder with multiple projects in my workspace, I want all my .qwen/ di
|
|
|
15
15
|
</when-to-use>
|
|
16
16
|
|
|
17
17
|
<framework>
|
|
18
|
-
@frameworks/
|
|
18
|
+
@frameworks/qwen-config-alignment.md
|
|
19
19
|
</framework>
|
|
20
20
|
|
|
21
21
|
<output-rules>
|
|
22
|
-
ALL audit findings MUST be written to a markdown report file at `.base/audits/
|
|
22
|
+
ALL audit findings MUST be written to a markdown report file at `.base/audits/qwen-config-{YYYY-MM-DD}.md`.
|
|
23
23
|
|
|
24
24
|
Do NOT dump findings into the chat as inline text. The chat is for brief status updates, questions, and confirmations only. The report is where all detail lives.
|
|
25
25
|
|
|
@@ -28,7 +28,7 @@ The report must be:
|
|
|
28
28
|
- Readable by a human who opens it in any markdown viewer
|
|
29
29
|
- Comprehensive: current state, classifications with evidence, remediation plan with risk levels, items kept and why
|
|
30
30
|
|
|
31
|
-
After writing the report, tell the operator: "Audit report written to `.base/audits/
|
|
31
|
+
After writing the report, tell the operator: "Audit report written to `.base/audits/qwen-config-{date}.md`. Review it, then tell me which remediation groups to execute."
|
|
32
32
|
|
|
33
33
|
During remediation execution, update the report with results (append a "Remediation Results" section).
|
|
34
34
|
</output-rules>
|
|
@@ -61,7 +61,7 @@ Classify every item in every project-level .qwen/ directory.
|
|
|
61
61
|
|
|
62
62
|
**CRITICAL: Git boundary awareness.**
|
|
63
63
|
|
|
64
|
-
The scanner dataset includes `git_boundary` data for each directory. This tells you what each project actually sees when
|
|
64
|
+
The scanner dataset includes `git_boundary` data for each directory. This tells you what each project actually sees when Qwen Code boots there:
|
|
65
65
|
|
|
66
66
|
- `has_own_git: true` → This project has its own git root. It does NOT see the workspace root `.qwen/` or workspace `.mcp.json`. It only sees global `~/.qwen/` + its own `.qwen/`.
|
|
67
67
|
- `has_own_git: false` → This project inherits the workspace root. It sees global `~/.qwen/` + workspace root `.qwen/` + its own `.qwen/`.
|
|
@@ -102,7 +102,7 @@ For own-git projects, the right framing is:
|
|
|
102
102
|
<step name="settings_reconciliation">
|
|
103
103
|
Analyze settings.json and settings.local.json files specifically.
|
|
104
104
|
|
|
105
|
-
These are the most dangerous files because they control
|
|
105
|
+
These are the most dangerous files because they control Qwen Code behavior:
|
|
106
106
|
|
|
107
107
|
1. For each project-level settings.json:
|
|
108
108
|
a. Parse hook definitions — list every hook command
|
|
@@ -162,7 +162,7 @@ If any reclassifications happen in this step, update all downstream plan entries
|
|
|
162
162
|
</step>
|
|
163
163
|
|
|
164
164
|
<step name="build_report">
|
|
165
|
-
Write the complete audit report to `.base/audits/
|
|
165
|
+
Write the complete audit report to `.base/audits/qwen-config-{YYYY-MM-DD}.md`.
|
|
166
166
|
|
|
167
167
|
Report structure:
|
|
168
168
|
1. **MD5 disclaimer** — Always include this at the top, right after the metadata block, as a blockquote:
|
|
@@ -183,7 +183,7 @@ Report structure:
|
|
|
183
183
|
6. **Items Kept (No Action)** — What's staying and exactly why
|
|
184
184
|
7. **Next Steps** — What the operator should do
|
|
185
185
|
|
|
186
|
-
Tell the operator: "Audit report written to `.base/audits/
|
|
186
|
+
Tell the operator: "Audit report written to `.base/audits/qwen-config-{date}.md`. Review it, then we'll decide how to handle remediation."
|
|
187
187
|
|
|
188
188
|
**Wait for operator to review the report before proceeding to graduation routing.**
|
|
189
189
|
</step>
|
|
@@ -197,7 +197,7 @@ Route remediation into a structured execution path. Present the operator with op
|
|
|
197
197
|
AUDIT COMPLETE — REMEDIATION ROUTING
|
|
198
198
|
════════════════════════════════════════
|
|
199
199
|
|
|
200
|
-
The audit report is ready at .base/audits/
|
|
200
|
+
The audit report is ready at .base/audits/qwen-config-{date}.md
|
|
201
201
|
|
|
202
202
|
How would you like to handle remediation?
|
|
203
203
|
|
|
@@ -227,7 +227,7 @@ How would you like to handle remediation?
|
|
|
227
227
|
2. cd {path}
|
|
228
228
|
3. Run /paul:init
|
|
229
229
|
4. When defining scope, reference the audit report:
|
|
230
|
-
@.base/audits/
|
|
230
|
+
@.base/audits/qwen-config-{date}.md
|
|
231
231
|
|
|
232
232
|
The audit report's Remediation Plan section maps directly
|
|
233
233
|
to PAUL phases — each remediation group can be a phase.
|
|
@@ -255,7 +255,7 @@ How would you like to handle remediation?
|
|
|
255
255
|
To proceed:
|
|
256
256
|
1. In the selected project, run /paul:milestone
|
|
257
257
|
2. When defining scope, reference the audit report:
|
|
258
|
-
@.base/audits/
|
|
258
|
+
@.base/audits/qwen-config-{date}.md
|
|
259
259
|
|
|
260
260
|
The audit report's Remediation Plan section provides
|
|
261
261
|
the scope — each remediation group maps to a phase.
|
|
@@ -304,9 +304,9 @@ Verify the workspace is healthy after all remediation and update the report.
|
|
|
304
304
|
- What was executed (by group)
|
|
305
305
|
- What was verified
|
|
306
306
|
- Any issues found during verification
|
|
307
|
-
- Projects the operator should test by opening
|
|
307
|
+
- Projects the operator should test by opening Qwen Code in them
|
|
308
308
|
|
|
309
|
-
Tell the operator: "Remediation complete. Report updated. Recommend testing
|
|
309
|
+
Tell the operator: "Remediation complete. Report updated. Recommend testing Qwen Code in: {list of modified projects}."
|
|
310
310
|
</step>
|
|
311
311
|
|
|
312
312
|
</steps>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<purpose>
|
|
2
|
-
Set up BASE in a new or existing workspace. Scan the workspace, ask guided questions, generate the manifest, install hooks, initialize JSON data surfaces, and run operator profile setup. Optional --full mode adds
|
|
2
|
+
Set up BASE in a new or existing workspace. Scan the workspace, ask guided questions, generate the manifest, install hooks, initialize JSON data surfaces, and run operator profile setup. Optional --full mode adds QWEN.md audit and guided first groom.
|
|
3
3
|
</purpose>
|
|
4
4
|
|
|
5
5
|
<user-story>
|
|
@@ -10,7 +10,7 @@ As an AI builder setting up my workspace, I want a guided scaffolding process th
|
|
|
10
10
|
- First-time BASE installation in any workspace
|
|
11
11
|
- When user says "base scaffold", "set up base", "initialize workspace management"
|
|
12
12
|
- Entry point routes here via /base:scaffold
|
|
13
|
-
- Use --full flag for batteries-included mode with
|
|
13
|
+
- Use --full flag for batteries-included mode with QWEN.md audit + first groom
|
|
14
14
|
</when-to-use>
|
|
15
15
|
|
|
16
16
|
<context>
|
|
@@ -23,7 +23,7 @@ As an AI builder setting up my workspace, I want a guided scaffolding process th
|
|
|
23
23
|
Determine scaffold mode.
|
|
24
24
|
|
|
25
25
|
1. Check if user specified `--full` or mentioned wanting full setup
|
|
26
|
-
2. If `--full`:
|
|
26
|
+
2. If `--full`: QWEN.md audit + first groom will be offered after data layer setup
|
|
27
27
|
3. If standard: data layer + hooks + operator profile
|
|
28
28
|
4. Announce mode: "Running BASE scaffold ({standard|full} mode)."
|
|
29
29
|
</step>
|
|
@@ -111,7 +111,7 @@ All hooks live in `.base/hooks/`. Session hooks are registered in `.qwen/setting
|
|
|
111
111
|
- psmm-injector.py — per-session meta memory injection
|
|
112
112
|
- operator.py — operator identity context injection
|
|
113
113
|
|
|
114
|
-
**SessionStart hooks** (fire once when
|
|
114
|
+
**SessionStart hooks** (fire once when Qwen Code starts a session):
|
|
115
115
|
- satellite-detection.py — PAUL project auto-registration and state sync
|
|
116
116
|
|
|
117
117
|
**On-demand hooks** (invoked by commands, not auto-registered):
|
|
@@ -121,7 +121,7 @@ All hooks live in `.base/hooks/`. Session hooks are registered in `.qwen/setting
|
|
|
121
121
|
|
|
122
122
|
### ENVIRONMENT DETECTION (REQUIRED — do this FIRST)
|
|
123
123
|
|
|
124
|
-
Hooks are shell commands that
|
|
124
|
+
Hooks are shell commands that Qwen Code executes. The python path AND file paths must work in the context where Qwen Code is running. Detect the environment before wiring anything.
|
|
125
125
|
|
|
126
126
|
**Step 1: Identify the platform.**
|
|
127
127
|
Run these commands and read the results:
|
|
@@ -137,9 +137,9 @@ echo $TERM_PROGRAM # vscode = VS Code integrated terminal
|
|
|
137
137
|
|---|---|---|---|
|
|
138
138
|
| **Native Linux** | `uname` = Linux, no WSL in /proc/version | `which python3` → use result | Native paths work |
|
|
139
139
|
| **Native macOS** | `uname` = Darwin | `which python3` → use result (often /opt/homebrew/bin/python3) | Native paths work |
|
|
140
|
-
| **WSL Terminal** (
|
|
140
|
+
| **WSL Terminal** (Qwen Code CLI in WSL) | Linux + "Microsoft" in /proc/version + NOT in VS Code | `which python3` → use result (typically /usr/bin/python3) | WSL paths work (/home/user/...) |
|
|
141
141
|
| **VS Code Extension (WSL Remote)** | Linux + WSL + TERM_PROGRAM=vscode | `which python3` → use result | WSL paths work (VS Code server runs inside WSL) |
|
|
142
|
-
| **VS Code Extension (Windows-native)** | platform: win32 in
|
|
142
|
+
| **VS Code Extension (Windows-native)** | platform: win32 in Qwen Code, OR `uname` returns MINGW/MSYS | See troubleshooting below | Windows paths required |
|
|
143
143
|
| **Native Windows** | No WSL, Windows paths | `where python` or `py -3` | Windows paths (C:\...) |
|
|
144
144
|
|
|
145
145
|
**Step 3: Handle the tricky cases.**
|
|
@@ -158,7 +158,7 @@ This is the hardest case. The VS Code extension runs on the Windows side but can
|
|
|
158
158
|
- This runs the VS Code server inside WSL — all hooks fire natively
|
|
159
159
|
- All WSL paths and python work correctly
|
|
160
160
|
|
|
161
|
-
2. **Use
|
|
161
|
+
2. **Use Qwen Code CLI in WSL terminal instead of VS Code extension:**
|
|
162
162
|
- Open a WSL terminal, `cd` to workspace, run `claude`
|
|
163
163
|
- All hooks fire natively in WSL context
|
|
164
164
|
- Use VS Code separately for editing if needed
|
|
@@ -178,7 +178,7 @@ This is the hardest case. The VS Code extension runs on the Windows side but can
|
|
|
178
178
|
```
|
|
179
179
|
This is fragile and NOT recommended for most users.
|
|
180
180
|
|
|
181
|
-
**IMPORTANT: Ask the user which environment they use
|
|
181
|
+
**IMPORTANT: Ask the user which environment they use Qwen Code in before proceeding.**
|
|
182
182
|
If they use multiple environments (e.g., CLI in WSL + VS Code extension), explain the constraints and recommend option 1 (VS Code Remote WSL).
|
|
183
183
|
|
|
184
184
|
---
|
|
@@ -199,7 +199,7 @@ For each auto-fire hook:
|
|
|
199
199
|
|
|
200
200
|
Hook registration format in settings.json:
|
|
201
201
|
|
|
202
|
-
**CRITICAL: Each event type array contains objects with a `hooks` array inside — NOT flat command objects.** This is the
|
|
202
|
+
**CRITICAL: Each event type array contains objects with a `hooks` array inside — NOT flat command objects.** This is the Qwen Code settings.json schema. Getting this wrong means hooks silently fail.
|
|
203
203
|
|
|
204
204
|
```json
|
|
205
205
|
{
|
|
@@ -236,16 +236,16 @@ If hooks aren't firing after setup, diagnose with these checks:
|
|
|
236
236
|
|
|
237
237
|
**Symptom: "operation blocked by hook" or "No such file"**
|
|
238
238
|
- Python path is wrong for the current environment
|
|
239
|
-
- Fix: re-detect python path for the environment
|
|
239
|
+
- Fix: re-detect python path for the environment Qwen Code is running in
|
|
240
240
|
|
|
241
241
|
**Symptom: Zero hooks fire (no CARL, no pulse, no calendar, nothing)**
|
|
242
242
|
- Likely a platform mismatch (Windows paths vs WSL paths)
|
|
243
243
|
- Check: `echo $PATH | tr ':' '\n' | grep python` — does python3 resolve?
|
|
244
|
-
- Check: Can
|
|
244
|
+
- Check: Can Qwen Code's shell access the hook file? Run `cat {hook_path}` to verify
|
|
245
245
|
|
|
246
246
|
**Symptom: Hooks fire in terminal but not in VS Code (or vice versa)**
|
|
247
|
-
- Different
|
|
248
|
-
- VS Code extension (Windows-native) ≠
|
|
247
|
+
- Different Qwen Code instances run in different contexts
|
|
248
|
+
- VS Code extension (Windows-native) ≠ Qwen Code CLI (WSL)
|
|
249
249
|
- Fix: Use VS Code Remote WSL extension so both contexts are WSL
|
|
250
250
|
|
|
251
251
|
**Symptom: "python3: command not found"**
|
|
@@ -306,11 +306,11 @@ The MCP server package lives globally at `~/.qwen/base-framework/packages/base-m
|
|
|
306
306
|
<step name="full_mode_extras">
|
|
307
307
|
**Full mode only.**
|
|
308
308
|
|
|
309
|
-
**
|
|
310
|
-
1. Check if
|
|
311
|
-
2. If exists: "Want me to audit your
|
|
309
|
+
**QWEN.md audit:**
|
|
310
|
+
1. Check if QWEN.md exists
|
|
311
|
+
2. If exists: "Want me to audit your QWEN.md against the QWEN.md Strategy?"
|
|
312
312
|
- If yes: route to `/base:audit-claude-md` (interactive, strategy-driven audit with CARL detection)
|
|
313
|
-
3. If doesn't exist: "Want me to generate a
|
|
313
|
+
3. If doesn't exist: "Want me to generate a QWEN.md from the strategy template?"
|
|
314
314
|
- If yes: use `@{~/.qwen/commands/qwen-base/templates/claudemd-template.md}` as starting point, fill from detected workspace structure
|
|
315
315
|
|
|
316
316
|
**First groom:**
|
|
@@ -347,8 +347,8 @@ Quick review and cleanup. Catches artifacts from path detection bugs, stale file
|
|
|
347
347
|
- Check `node_modules/` exists in `.base/base-mcp/`
|
|
348
348
|
- If broken: fix it (copy from global, npm install, re-register)
|
|
349
349
|
|
|
350
|
-
5. **Structure alignment** — Verify workspace matches
|
|
351
|
-
- Read
|
|
350
|
+
5. **Structure alignment** — Verify workspace matches QWEN.md's Where section:
|
|
351
|
+
- Read QWEN.md (if it exists) and extract the Where section
|
|
352
352
|
- Compare declared directories against what actually exists
|
|
353
353
|
- Flag any mismatches (declared but not created, or created but not declared)
|
|
354
354
|
- Don't auto-fix — just report for user awareness
|
|
@@ -369,7 +369,7 @@ If everything is clean: "Workspace is clean. No artifacts, all paths valid, stru
|
|
|
369
369
|
</steps>
|
|
370
370
|
|
|
371
371
|
<output>
|
|
372
|
-
Fully configured BASE installation. Standard mode: data layer with JSON surfaces, hooks wired, operator profile setup, MCP registered, post-scaffold cleanup verified. Full mode: adds
|
|
372
|
+
Fully configured BASE installation. Standard mode: data layer with JSON surfaces, hooks wired, operator profile setup, MCP registered, post-scaffold cleanup verified. Full mode: adds QWEN.md audit and guided first groom.
|
|
373
373
|
</output>
|
|
374
374
|
|
|
375
375
|
<acceptance-criteria>
|
|
@@ -383,7 +383,7 @@ Fully configured BASE installation. Standard mode: data layer with JSON surfaces
|
|
|
383
383
|
- [ ] All auto-fire hooks installed and registered in settings.json (UserPromptSubmit + SessionStart)
|
|
384
384
|
- [ ] BASE MCP server wired in .mcp.json
|
|
385
385
|
- [ ] Post-scaffold cleanup passed (no artifacts, valid paths, structure aligned)
|
|
386
|
-
- [ ] (Full mode)
|
|
386
|
+
- [ ] (Full mode) QWEN.md audit offered
|
|
387
387
|
- [ ] (Full mode) First groom offered
|
|
388
388
|
- [ ] Operator informed of next groom date
|
|
389
389
|
</acceptance-criteria>
|
|
@@ -124,8 +124,8 @@ If any items couldn't be auto-mapped, present them for manual resolution.
|
|
|
124
124
|
<step name="cleanup">
|
|
125
125
|
## Step 6: Clean Up
|
|
126
126
|
|
|
127
|
-
1. Check if the original file is @-referenced in
|
|
128
|
-
2. If found, offer: "Remove @{file} from
|
|
127
|
+
1. Check if the original file is @-referenced in QWEN.md
|
|
128
|
+
2. If found, offer: "Remove @{file} from QWEN.md? The surface hook replaces it."
|
|
129
129
|
3. Suggest: "Original file preserved at {path} for reference."
|
|
130
130
|
|
|
131
131
|
Do NOT delete the original markdown file — the user decides its fate.
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
#
|
|
1
|
+
# QWEN.md Template
|
|
2
2
|
|
|
3
|
-
Reference template for generating strategy-compliant
|
|
3
|
+
Reference template for generating strategy-compliant QWEN.md files. Placeholders use `{PLACEHOLDER}` format. Comments use `<!-- -->` and must be removed in final output.
|
|
4
4
|
|
|
5
5
|
***
|
|
6
6
|
|
|
7
7
|
```Markdown
|
|
8
|
-
#
|
|
8
|
+
# QWEN.md
|
|
9
9
|
|
|
10
10
|
## What
|
|
11
11
|
|
|
12
|
-
This file provides guidance to
|
|
12
|
+
This file provides guidance to Qwen Code (claude.ai/code) when working with code in this repository.
|
|
13
13
|
|
|
14
14
|
---
|
|
15
15
|
|
|
@@ -97,6 +97,6 @@ NEVER {WRONG_ACTION} — {RIGHT_ACTION}
|
|
|
97
97
|
* Remove all `<!-- -->` comments before finalizing
|
|
98
98
|
* Remove placeholder sections that don't apply (not every workspace needs Git Strategy or Systems)
|
|
99
99
|
* The Where tree should reflect the ACTUAL filesystem, verified by scanning
|
|
100
|
-
* Rules should be workspace-identity-level, not operational. If a rule only applies during specific work (e.g., "when writing tests..."), it belongs in a domain-specific rule system, not
|
|
100
|
+
* Rules should be workspace-identity-level, not operational. If a rule only applies during specific work (e.g., "when writing tests..."), it belongs in a domain-specific rule system, not QWEN.md
|
|
101
101
|
* `@` references point Claude to files it should read on demand — use for anything volatile or detailed
|
|
102
102
|
|
|
@@ -270,16 +270,16 @@ def find_git_root(directory):
|
|
|
270
270
|
|
|
271
271
|
|
|
272
272
|
def detect_git_boundary(claude_dir, workspace_root):
|
|
273
|
-
"""Determine which config layers are visible when
|
|
273
|
+
"""Determine which config layers are visible when Qwen Code boots in this directory.
|
|
274
274
|
|
|
275
|
-
|
|
275
|
+
Qwen Code resolves the project root from the nearest .git boundary.
|
|
276
276
|
- Global ~/.qwen/ is always visible
|
|
277
277
|
- Workspace root .qwen/ is only visible if the project's git root IS the workspace root
|
|
278
278
|
- The project's own .qwen/ is visible if it's at or under the git root
|
|
279
279
|
|
|
280
280
|
Returns a dict describing the visibility context.
|
|
281
281
|
"""
|
|
282
|
-
# The .claude dir's parent is where
|
|
282
|
+
# The .claude dir's parent is where Qwen Code would boot
|
|
283
283
|
parent_dir = os.path.dirname(claude_dir)
|
|
284
284
|
git_root = find_git_root(parent_dir)
|
|
285
285
|
|
package/src/hooks/_template.py
CHANGED
|
@@ -70,7 +70,7 @@ For details on any item, use base_get_item("{SURFACE_NAME}", id)."""
|
|
|
70
70
|
|
|
71
71
|
|
|
72
72
|
def main():
|
|
73
|
-
# --- Read hook input from stdin (
|
|
73
|
+
# --- Read hook input from stdin (Qwen Code provides session context) ---
|
|
74
74
|
try:
|
|
75
75
|
input_data = json.loads(sys.stdin.read())
|
|
76
76
|
session_id = input_data.get("session_id", "")
|
|
@@ -5,7 +5,7 @@ Purpose: Per-Session Meta Memory — inject ephemeral session observations
|
|
|
5
5
|
into every prompt so they stay hot in long sessions (1M window).
|
|
6
6
|
|
|
7
7
|
Uses a single psmm.json file with session-keyed entries.
|
|
8
|
-
Each session gets its own array keyed by
|
|
8
|
+
Each session gets its own array keyed by Qwen Code session UUID.
|
|
9
9
|
Stale sessions are NOT auto-cleaned — that's the operator's job
|
|
10
10
|
via CARL hygiene / BASE drift detection.
|
|
11
11
|
|
|
@@ -4,7 +4,7 @@ Hook: satellite-detection.py
|
|
|
4
4
|
Purpose: Scans the workspace recursively for .paul/paul.json files,
|
|
5
5
|
auto-registers new satellites, and syncs paul.json state to
|
|
6
6
|
workspace.json and projects.json.
|
|
7
|
-
Triggers: SessionStart — runs once when
|
|
7
|
+
Triggers: SessionStart — runs once when Qwen Code starts a session.
|
|
8
8
|
Output: <base-satellites> block if new satellites registered, silent otherwise.
|
|
9
9
|
|
|
10
10
|
Sync flow (paul.json → workspace.json → projects.json):
|
package/src/skill/base.md
CHANGED
|
@@ -3,14 +3,14 @@ name: base
|
|
|
3
3
|
type: suite
|
|
4
4
|
version: 0.1.0
|
|
5
5
|
category: workspace-orchestration
|
|
6
|
-
description: "Builder's Automated State Engine — workspace lifecycle management for
|
|
6
|
+
description: "Builder's Automated State Engine — workspace lifecycle management for Qwen Code. Scaffold, audit, groom, and maintain AI builder workspaces. Manage data surfaces for structured context injection. Use when user mentions workspace setup, cleanup, organization, maintenance, grooming, auditing workspace health, surfaces, or BASE."
|
|
7
7
|
allowed-tools: [Read, Write, Glob, Grep, Edit, Bash, Agent, AskUserQuestion]
|
|
8
8
|
---
|
|
9
9
|
|
|
10
10
|
<activation>
|
|
11
11
|
|
|
12
12
|
## What
|
|
13
|
-
BASE (Builder's Automated State Engine) manages the lifecycle of a
|
|
13
|
+
BASE (Builder's Automated State Engine) manages the lifecycle of a Qwen Code workspace. It scaffolds new workspaces, audits existing ones, runs structured grooming cycles, and maintains workspace health through automated drift detection.
|
|
14
14
|
|
|
15
15
|
## When to Use
|
|
16
16
|
- User says "base", "workspace", "cleanup", "organize", "audit my workspace", "groom", "surface", "create a surface"
|
|
@@ -45,7 +45,7 @@ Workspace operations engineer. Knows the territory, tracks what's drifting, enfo
|
|
|
45
45
|
- Context document lifecycle (projects.json, state.json, entities.json)
|
|
46
46
|
- Tool and configuration management
|
|
47
47
|
- Drift detection and prevention patterns
|
|
48
|
-
-
|
|
48
|
+
- Qwen Code ecosystem (PAUL, CARL, AEGIS, Skillsmith integration)
|
|
49
49
|
|
|
50
50
|
</persona>
|
|
51
51
|
|
|
@@ -59,7 +59,7 @@ Workspace operations engineer. Knows the territory, tracks what's drifting, enfo
|
|
|
59
59
|
| `/base:scaffold` | Set up BASE in a new workspace | `@{~/.qwen/commands/qwen-base/tasks/scaffold.md}` |
|
|
60
60
|
| `/base:status` | Quick health check (one-liner) | `@{~/.qwen/commands/qwen-base/tasks/status.md}` |
|
|
61
61
|
| `/base:history` | Workspace evolution timeline | `@{~/.qwen/commands/qwen-base/tasks/history.md}` |
|
|
62
|
-
| `/base:audit-claude-md` | Audit
|
|
62
|
+
| `/base:audit-claude-md` | Audit QWEN.md, generate recommended version | `@{~/.qwen/commands/qwen-base/tasks/audit-claude-md.md}` |
|
|
63
63
|
| `/base:carl-hygiene` | CARL domain maintenance and rule review | `@{~/.qwen/commands/qwen-base/tasks/carl-hygiene.md}` |
|
|
64
64
|
| `/base:surface create` | Create a new data surface (guided) | `@{~/.qwen/commands/qwen-base/tasks/surface-create.md}` |
|
|
65
65
|
| `/base:surface convert` | Convert markdown file to data surface | `@{~/.qwen/commands/qwen-base/tasks/surface-convert.md}` |
|