qwen-base 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +183 -0
- package/bin/install.js +227 -0
- package/package.json +42 -0
- package/src/commands/audit-claude-md.md +44 -0
- package/src/commands/audit-claude.md +45 -0
- package/src/commands/audit.md +33 -0
- package/src/commands/carl-hygiene.md +33 -0
- package/src/commands/groom.md +35 -0
- package/src/commands/history.md +27 -0
- package/src/commands/orientation/tasks/deep-why.md +132 -0
- package/src/commands/orientation/tasks/elevator-pitch.md +115 -0
- package/src/commands/orientation/tasks/initiatives.md +98 -0
- package/src/commands/orientation/tasks/key-values.md +130 -0
- package/src/commands/orientation/tasks/new-orientation.md +162 -0
- package/src/commands/orientation/tasks/north-star.md +97 -0
- package/src/commands/orientation/tasks/project-mapping.md +103 -0
- package/src/commands/orientation/tasks/reorientation.md +96 -0
- package/src/commands/orientation/tasks/surface-vision.md +113 -0
- package/src/commands/orientation/tasks/task-seeding.md +93 -0
- package/src/commands/orientation/templates/operator-json.md +88 -0
- package/src/commands/orientation.md +87 -0
- package/src/commands/pulse.md +33 -0
- package/src/commands/scaffold.md +33 -0
- package/src/commands/status.md +28 -0
- package/src/commands/surface-convert.md +35 -0
- package/src/commands/surface-create.md +34 -0
- package/src/commands/surface-list.md +27 -0
- package/src/commands/weekly-domain.md +34 -0
- package/src/commands/weekly.md +39 -0
- package/src/framework/context/base-principles.md +69 -0
- package/src/framework/frameworks/audit-strategies.md +53 -0
- package/src/framework/frameworks/claude-config-alignment.md +256 -0
- package/src/framework/frameworks/claudemd-strategy.md +158 -0
- package/src/framework/frameworks/satellite-registration.md +44 -0
- package/src/framework/tasks/audit-claude-md.md +171 -0
- package/src/framework/tasks/audit-claude.md +330 -0
- package/src/framework/tasks/audit.md +64 -0
- package/src/framework/tasks/carl-hygiene.md +142 -0
- package/src/framework/tasks/groom.md +157 -0
- package/src/framework/tasks/history.md +34 -0
- package/src/framework/tasks/pulse.md +83 -0
- package/src/framework/tasks/scaffold.md +389 -0
- package/src/framework/tasks/status.md +35 -0
- package/src/framework/tasks/surface-convert.md +143 -0
- package/src/framework/tasks/surface-create.md +184 -0
- package/src/framework/tasks/surface-list.md +42 -0
- package/src/framework/tasks/weekly-domain-create.md +173 -0
- package/src/framework/tasks/weekly.md +347 -0
- package/src/framework/templates/claudemd-template.md +102 -0
- package/src/framework/templates/workspace-json.md +96 -0
- package/src/framework/utils/scan-claude-dirs.py +549 -0
- package/src/hooks/_template.py +130 -0
- package/src/hooks/active-hook.py +178 -0
- package/src/hooks/apex-insights.py +169 -0
- package/src/hooks/backlog-hook.py +115 -0
- package/src/hooks/base-pulse-check.py +216 -0
- package/src/hooks/operator.py +53 -0
- package/src/hooks/psmm-injector.py +67 -0
- package/src/hooks/satellite-detection.py +320 -0
- package/src/packages/base-mcp/index.js +119 -0
- package/src/packages/base-mcp/package.json +10 -0
- package/src/packages/base-mcp/tools/entities.js +228 -0
- package/src/packages/base-mcp/tools/operator.js +106 -0
- package/src/packages/base-mcp/tools/projects.js +324 -0
- package/src/packages/base-mcp/tools/psmm.js +206 -0
- package/src/packages/base-mcp/tools/satellite.js +243 -0
- package/src/packages/base-mcp/tools/state.js +201 -0
- package/src/packages/base-mcp/tools/validate.js +121 -0
- package/src/skill/base.md +110 -0
- package/src/templates/operator.json +66 -0
- package/src/templates/workspace.json +76 -0
package/README.md
ADDED
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
# Qwen-BASE **Builder's Automated State Engine** — Your AI builder operating system for Qwen Code.
|
|
2
|
+
|
|
3
|
+
```bash
|
|
4
|
+
npx qwen-base
|
|
5
|
+
```
|
|
6
|
+
|
|
7
|
+
**Works on Mac, Windows, and Linux.**
|
|
8
|
+
|
|
9
|
+
*"Turn Qwen Code from a per-session tool into a workspace that remembers, maintains itself, and never goes stale."*
|
|
10
|
+
|
|
11
|
+
[The Problem](#the-problem) · [What BASE Does](#what-base-actually-does) · [Commands](#commands) · [Hooks](#hooks) · [MCP Server](#mcp-server) · [Operator Profile](#operator-profile) · [PSMM](#psmm) · [Install](#install)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## The Problem
|
|
16
|
+
|
|
17
|
+
Every Qwen Code session starts fresh. Your workspace structure, project state, active contexts, and accumulated knowledge? Gone. You end up rebuilding context manually every time. Over time, workspace files drift — configs go stale, surfaces aren't updated, projects accumulate without organization.
|
|
18
|
+
|
|
19
|
+
BASE fixes this by turning Qwen Code into a **maintained workspace**, not a per-session scratchpad.
|
|
20
|
+
|
|
21
|
+
---
|
|
22
|
+
|
|
23
|
+
## What BASE Actually Does
|
|
24
|
+
|
|
25
|
+
1. **Scaffold** — Set up a new workspace with structured data files (workspace.json, operator.json, state.json, entities.json, projects.json)
|
|
26
|
+
2. **Pulse** — Daily activation: workspace health briefing, what's changed, what needs attention
|
|
27
|
+
3. **Groom** — Weekly maintenance cycle: archive stale items, update contexts, clean surfaces
|
|
28
|
+
4. **Audit** — Deep workspace optimization: find drift, fix inconsistencies, optimize structure
|
|
29
|
+
5. **Surfaces** — Structured data injection: convert markdown files into context-rich data surfaces
|
|
30
|
+
6. **CARL Hygiene** — Maintain CARL domains: archive stale rules, review decisions, clean up
|
|
31
|
+
|
|
32
|
+
---
|
|
33
|
+
|
|
34
|
+
## Commands
|
|
35
|
+
|
|
36
|
+
| Command | What It Does |
|
|
37
|
+
|---------|-------------|
|
|
38
|
+
| `/base:pulse` | Daily activation — workspace health briefing |
|
|
39
|
+
| `/base:groom` | Weekly maintenance cycle |
|
|
40
|
+
| `/base:audit` | Deep workspace optimization |
|
|
41
|
+
| `/base:scaffold` | Set up BASE in a new workspace |
|
|
42
|
+
| `/base:status` | Quick health check (one-liner) |
|
|
43
|
+
| `/base:history` | Workspace evolution timeline |
|
|
44
|
+
| `/base:audit-claude-md` | Audit Qwen config, generate recommended version |
|
|
45
|
+
| `/base:carl-hygiene` | CARL domain maintenance and rule review |
|
|
46
|
+
| `/base:surface create` | Create a new data surface (guided) |
|
|
47
|
+
| `/base:surface convert` | Convert markdown file to data surface |
|
|
48
|
+
| `/base:surface list` | Show all registered surfaces |
|
|
49
|
+
| `/base:orientation` | Deep-dive session to define workspace identity |
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Hooks
|
|
54
|
+
|
|
55
|
+
BASE installs Python hooks that run automatically in your Qwen Code sessions:
|
|
56
|
+
|
|
57
|
+
| Hook | Event | What It Does |
|
|
58
|
+
|------|-------|-------------|
|
|
59
|
+
| `active-hook.py` | SessionStart | Injects active workspace context (operator, state, projects) |
|
|
60
|
+
| `psmm-injector.py` | SessionStart | Per-Session Meta-Memory — tracks session context |
|
|
61
|
+
| `backlog-hook.py` | SessionStart | Injects backlog/deferred items from state.json |
|
|
62
|
+
| `satellite-detection.py` | SessionStart | Detects PAUL projects and registers them as satellites |
|
|
63
|
+
| `operator.py` | SessionStart | Injects operator profile (who you are, always in context) |
|
|
64
|
+
| `base-pulse-check.py` | SessionStart | Checks if grooming is overdue and suggests maintenance |
|
|
65
|
+
| `apex-insights.py` | Stop | End-of-session analytics — session summary and trends |
|
|
66
|
+
|
|
67
|
+
---
|
|
68
|
+
|
|
69
|
+
## MCP Server
|
|
70
|
+
|
|
71
|
+
BASE includes an MCP server with tools for workspace data management:
|
|
72
|
+
|
|
73
|
+
| Tool | What It Does |
|
|
74
|
+
|------|-------------|
|
|
75
|
+
| `base_read_state` | Read current workspace state |
|
|
76
|
+
| `base_write_state` | Update workspace state |
|
|
77
|
+
| `base_read_entities` | Read entities (tools, platforms, services) |
|
|
78
|
+
| `base_write_entities` | Add/update entities |
|
|
79
|
+
| `base_read_projects` | Read project registry |
|
|
80
|
+
| `base_write_projects` | Add/update projects |
|
|
81
|
+
| `base_read_operator` | Read operator profile |
|
|
82
|
+
| `base_write_operator` | Update operator profile |
|
|
83
|
+
| `base_validate` | Validate workspace data integrity |
|
|
84
|
+
| `base_satellite_register` | Register a PAUL project as a satellite |
|
|
85
|
+
| `base_psmm_store` | Store per-session meta-memory |
|
|
86
|
+
| `base_psmm_retrieve` | Retrieve per-session meta-memory |
|
|
87
|
+
|
|
88
|
+
---
|
|
89
|
+
|
|
90
|
+
## Operator Profile
|
|
91
|
+
|
|
92
|
+
The operator profile (`operator.json`) defines **who you are** — your skills, preferences, constraints, and goals. Once set, this context is injected into every session. No more re-explaining yourself.
|
|
93
|
+
|
|
94
|
+
---
|
|
95
|
+
|
|
96
|
+
## PSMM — Per-Session Meta-Memory
|
|
97
|
+
|
|
98
|
+
PSMM tracks what happens in each session: what you worked on, what decisions were made, what changed. This creates a continuous memory across sessions that Qwen can reference.
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## How The Ecosystem Fits Together
|
|
103
|
+
|
|
104
|
+
| Tool | What It Does | How BASE Uses It |
|
|
105
|
+
|------|-------------|-----------------|
|
|
106
|
+
| **qwen-paul** | Project orchestration (Plan, Apply, Unify) | BASE detects PAUL projects as satellites, tracks their state |
|
|
107
|
+
| **carl-qwen** | Dynamic rule injection | BASE runs CARL hygiene — archives stale rules, reviews decisions |
|
|
108
|
+
| **qwen-seed** | Typed project incubator | BASE tracks graduated projects in workspace state |
|
|
109
|
+
| **qwen-aegis** | Codebase auditing | BASE recommends audits as part of grooming cycles |
|
|
110
|
+
|
|
111
|
+
---
|
|
112
|
+
|
|
113
|
+
## Install
|
|
114
|
+
|
|
115
|
+
```bash
|
|
116
|
+
npx qwen-base
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
The installer prompts you to choose:
|
|
120
|
+
|
|
121
|
+
1. **Global** (recommended) — Available in all Qwen Code projects
|
|
122
|
+
2. **Local** — Available in current project only
|
|
123
|
+
|
|
124
|
+
### What Gets Installed
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
~/.qwen/commands/qwen-base/
|
|
128
|
+
├── base.md Entry point (routing + persona)
|
|
129
|
+
├── framework/ Tasks, templates, frameworks (11 commands)
|
|
130
|
+
├── commands/ Command definitions
|
|
131
|
+
├── hooks/ 7 Python hooks for workspace intelligence
|
|
132
|
+
├── templates/ operator.json, workspace.json templates
|
|
133
|
+
└── base-mcp/ MCP server for workspace data management
|
|
134
|
+
|
|
135
|
+
~/.qwen/settings.json Hook registration (merged)
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Quick Start
|
|
141
|
+
|
|
142
|
+
```
|
|
143
|
+
# 1. Scaffold a new workspace
|
|
144
|
+
/base:scaffold
|
|
145
|
+
|
|
146
|
+
# 2. Define your operator profile
|
|
147
|
+
(base guides you through who you are)
|
|
148
|
+
|
|
149
|
+
# 3. Daily pulse
|
|
150
|
+
/base:pulse
|
|
151
|
+
|
|
152
|
+
# 4. Weekly maintenance
|
|
153
|
+
/base:groom
|
|
154
|
+
|
|
155
|
+
# 5. Deep audit when things feel messy
|
|
156
|
+
/base:audit
|
|
157
|
+
```
|
|
158
|
+
|
|
159
|
+
---
|
|
160
|
+
|
|
161
|
+
## Design Principles
|
|
162
|
+
|
|
163
|
+
1. **Workspace over sessions** — Your workspace persists, sessions don't
|
|
164
|
+
2. **Data over documents** — Structured JSON, not just markdown
|
|
165
|
+
3. **Maintained over drifting** — Regular grooming prevents staleness
|
|
166
|
+
4. **Detective over prescriptive** — Finds problems, doesn't dictate solutions
|
|
167
|
+
|
|
168
|
+
---
|
|
169
|
+
|
|
170
|
+
## License
|
|
171
|
+
|
|
172
|
+
MIT License.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Author
|
|
177
|
+
|
|
178
|
+
**Chris Kahler** — [Chris AI Systems](https://github.com/ChristopherKahler)
|
|
179
|
+
Adapted for Qwen Code by [tylergriffin1350](https://github.com/tylergriffin1350)
|
|
180
|
+
|
|
181
|
+
---
|
|
182
|
+
|
|
183
|
+
**Qwen Code is powerful. BASE makes it reliable.**
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,227 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
const fs = require('fs');
|
|
4
|
+
const path = require('path');
|
|
5
|
+
const os = require('os');
|
|
6
|
+
|
|
7
|
+
// Colors
|
|
8
|
+
const green = '\x1b[32m';
|
|
9
|
+
const cyan = '\x1b[36m';
|
|
10
|
+
const yellow = '\x1b[33m';
|
|
11
|
+
const dim = '\x1b[2m';
|
|
12
|
+
const reset = '\x1b[0m';
|
|
13
|
+
|
|
14
|
+
const pkg = require('../package.json');
|
|
15
|
+
|
|
16
|
+
const banner = `
|
|
17
|
+
${green} ██████╗ ███████╗███████╗██████╗
|
|
18
|
+
██╔══██╗██╔════╝██╔════╝██╔══██╗
|
|
19
|
+
██████╔╝█████╗ █████╗ ██████╔╝
|
|
20
|
+
██╔══██╗██╔══╝ ██╔══╝ ██╔══██╗
|
|
21
|
+
██║ ██║███████╗███████╗██║ ██║
|
|
22
|
+
╚═╝ ╚═╝╚══════╝╚══════╝╚═╝ ╚═╝${reset}
|
|
23
|
+
|
|
24
|
+
BASE ${dim}v${pkg.version}${reset}
|
|
25
|
+
Builder's Automated State Engine
|
|
26
|
+
for Qwen Code
|
|
27
|
+
`;
|
|
28
|
+
|
|
29
|
+
const args = process.argv.slice(2);
|
|
30
|
+
const hasHelp = args.includes('--help') || args.includes('-h');
|
|
31
|
+
const hasLocal = args.includes('--local') || args.includes('-l');
|
|
32
|
+
|
|
33
|
+
function parseConfigDirArg() {
|
|
34
|
+
const idx = args.findIndex(arg => arg === '--config-dir' || arg === '-c');
|
|
35
|
+
if (idx !== -1) {
|
|
36
|
+
const nextArg = args[idx + 1];
|
|
37
|
+
if (!nextArg || nextArg.startsWith('-')) {
|
|
38
|
+
console.error(` ${yellow}--config-dir requires a path argument${reset}`);
|
|
39
|
+
process.exit(1);
|
|
40
|
+
}
|
|
41
|
+
return nextArg;
|
|
42
|
+
}
|
|
43
|
+
const configDirArg = args.find(arg => arg.startsWith('--config-dir=') || arg.startsWith('-c='));
|
|
44
|
+
if (configDirArg) {
|
|
45
|
+
return configDirArg.split('=')[1];
|
|
46
|
+
}
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
function expandTilde(filePath) {
|
|
51
|
+
if (filePath && filePath.startsWith('~/')) {
|
|
52
|
+
return path.join(os.homedir(), filePath.slice(2));
|
|
53
|
+
}
|
|
54
|
+
return filePath;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
function copyDir(srcDir, destDir, skipDirs = []) {
|
|
58
|
+
fs.mkdirSync(destDir, { recursive: true });
|
|
59
|
+
const entries = fs.readdirSync(srcDir, { withFileTypes: true });
|
|
60
|
+
for (const entry of entries) {
|
|
61
|
+
if (skipDirs.includes(entry.name)) continue;
|
|
62
|
+
const srcPath = path.join(srcDir, entry.name);
|
|
63
|
+
const destPath = path.join(destDir, entry.name);
|
|
64
|
+
if (entry.isDirectory()) {
|
|
65
|
+
copyDir(srcPath, destPath, skipDirs);
|
|
66
|
+
} else {
|
|
67
|
+
fs.copyFileSync(srcPath, destPath);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
function countFiles(dir, ext) {
|
|
73
|
+
let count = 0;
|
|
74
|
+
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
75
|
+
for (const entry of entries) {
|
|
76
|
+
const fullPath = path.join(dir, entry.name);
|
|
77
|
+
if (entry.isDirectory()) {
|
|
78
|
+
count += countFiles(fullPath, ext);
|
|
79
|
+
} else if (!ext || entry.name.endsWith(ext)) {
|
|
80
|
+
count++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
return count;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
console.log(banner);
|
|
87
|
+
|
|
88
|
+
if (hasHelp) {
|
|
89
|
+
console.log(` ${yellow}Usage:${reset} npx qwen-base [options]
|
|
90
|
+
|
|
91
|
+
${yellow}Options:${reset}
|
|
92
|
+
${cyan}-l, --local${reset} Install to ./.qwen/commands/ instead of global
|
|
93
|
+
${cyan}-c, --config-dir <path>${reset} Specify custom Qwen config directory
|
|
94
|
+
${cyan}-h, --help${reset} Show this help message
|
|
95
|
+
|
|
96
|
+
${yellow}Examples:${reset}
|
|
97
|
+
${dim}# Install globally (default)${reset}
|
|
98
|
+
npx qwen-base
|
|
99
|
+
|
|
100
|
+
${dim}# Install to current project only${reset}
|
|
101
|
+
npx qwen-base --local
|
|
102
|
+
|
|
103
|
+
${yellow}What gets installed:${reset}
|
|
104
|
+
${cyan}commands/qwen-base/${reset}
|
|
105
|
+
base.md Entry point (routing + persona)
|
|
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
|
|
111
|
+
`);
|
|
112
|
+
process.exit(0);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
const explicitConfigDir = parseConfigDirArg();
|
|
116
|
+
const configDir = expandTilde(explicitConfigDir) || expandTilde(process.env.QWEN_CONFIG_DIR);
|
|
117
|
+
const globalDir = configDir || path.join(os.homedir(), '.qwen');
|
|
118
|
+
const qwenDir = hasLocal ? path.join(process.cwd(), '.qwen') : globalDir;
|
|
119
|
+
const baseDest = path.join(qwenDir, 'commands', 'qwen-base');
|
|
120
|
+
|
|
121
|
+
const locationLabel = hasLocal
|
|
122
|
+
? baseDest.replace(process.cwd(), '.')
|
|
123
|
+
: baseDest.replace(os.homedir(), '~');
|
|
124
|
+
|
|
125
|
+
if (fs.existsSync(baseDest)) {
|
|
126
|
+
console.log(` ${yellow}Existing installation found at ${locationLabel}${reset}`);
|
|
127
|
+
console.log(` Updating...`);
|
|
128
|
+
fs.rmSync(baseDest, { recursive: true, force: true });
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
console.log(` Installing to ${cyan}${locationLabel}${reset}\n`);
|
|
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}`);
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
// Wire hooks into .qwen/settings.json
|
|
186
|
+
function wireHooks(qwenDir, hooksDir) {
|
|
187
|
+
const settingsPath = path.join(qwenDir, 'settings.json');
|
|
188
|
+
let settings = {};
|
|
189
|
+
if (fs.existsSync(settingsPath)) {
|
|
190
|
+
try { settings = JSON.parse(fs.readFileSync(settingsPath, 'utf8')); } catch (e) {}
|
|
191
|
+
}
|
|
192
|
+
if (!settings.hooks) settings.hooks = {};
|
|
193
|
+
|
|
194
|
+
const hookFiles = fs.readdirSync(hooksDir).filter(f => f.endsWith('.py') && !f.startsWith('_'));
|
|
195
|
+
for (const hookFile of hookFiles) {
|
|
196
|
+
const hookName = hookFile.replace('.py', '');
|
|
197
|
+
const hookPath = path.join(hooksDir, hookFile).replace(/\\/g, '/');
|
|
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
|
+
}
|
|
218
|
+
}
|
|
219
|
+
fs.writeFileSync(settingsPath, JSON.stringify(settings, null, 2));
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
wireHooks(qwenDir, hooksDest);
|
|
223
|
+
console.log(` ${green}+${reset} Hooks wired in settings.json${reset}`);
|
|
224
|
+
|
|
225
|
+
console.log(`
|
|
226
|
+
${green}Done!${reset} Open Qwen Code and type ${cyan}/base${reset} to start.
|
|
227
|
+
`);
|
package/package.json
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "qwen-base",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Builder's Automated State Engine — workspace lifecycle management for Qwen Code",
|
|
5
|
+
"bin": {
|
|
6
|
+
"qwen-base": "bin/install.js"
|
|
7
|
+
},
|
|
8
|
+
"files": [
|
|
9
|
+
"bin",
|
|
10
|
+
"src/skill",
|
|
11
|
+
"src/framework",
|
|
12
|
+
"src/commands",
|
|
13
|
+
"src/hooks",
|
|
14
|
+
"src/templates",
|
|
15
|
+
"src/packages",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"keywords": [
|
|
19
|
+
"qwen",
|
|
20
|
+
"qwen-code",
|
|
21
|
+
"qwen-cli",
|
|
22
|
+
"ai",
|
|
23
|
+
"workspace",
|
|
24
|
+
"state-management",
|
|
25
|
+
"base",
|
|
26
|
+
"maintenance",
|
|
27
|
+
"drift-detection"
|
|
28
|
+
],
|
|
29
|
+
"author": "Chris Kahler (adapted for Qwen by tylergriffin1350)",
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "git+https://github.com/tylergriffin1350/qwen-base.git"
|
|
34
|
+
},
|
|
35
|
+
"bugs": {
|
|
36
|
+
"url": "https://github.com/tylergriffin1350/qwen-base/issues"
|
|
37
|
+
},
|
|
38
|
+
"homepage": "https://github.com/tylergriffin1350/qwen-base#readme",
|
|
39
|
+
"engines": {
|
|
40
|
+
"node": ">=16.7.0"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: base:audit-claude-md
|
|
3
|
+
description: Audit CLAUDE.md against the CLAUDE.md Strategy and generate a compliant version
|
|
4
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Audit the project's CLAUDE.md for strategy compliance, interactively rewrite it section by section, and route operational rules to CARL or an artifact.
|
|
9
|
+
|
|
10
|
+
**When to use:** "audit claude md", "check my claude.md", "rewrite my claude.md", after major workspace changes.
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<execution_context>
|
|
14
|
+
@{~/.qwen/commands/qwen-base/frameworks/claudemd-strategy.md}
|
|
15
|
+
@{~/.qwen/commands/qwen-base/templates/claudemd-template.md}
|
|
16
|
+
@{~/.qwen/commands/qwen-base/tasks/audit-claude-md.md}
|
|
17
|
+
</execution_context>
|
|
18
|
+
|
|
19
|
+
<context>
|
|
20
|
+
$ARGUMENTS
|
|
21
|
+
|
|
22
|
+
@CLAUDE.md
|
|
23
|
+
</context>
|
|
24
|
+
|
|
25
|
+
<process>
|
|
26
|
+
Follow task: @{~/.qwen/commands/qwen-base/tasks/audit-claude-md.md}
|
|
27
|
+
|
|
28
|
+
Key gates (do NOT skip):
|
|
29
|
+
1. Load strategy + template BEFORE reading user's CLAUDE.md
|
|
30
|
+
2. Present full audit classification — wait for user approval
|
|
31
|
+
3. Detect CARL — wait for user decision on rule routing
|
|
32
|
+
4. Propose each section individually — wait for approval per section
|
|
33
|
+
5. Write to CLAUDE.base.md (never overwrite CLAUDE.md)
|
|
34
|
+
</process>
|
|
35
|
+
|
|
36
|
+
<success_criteria>
|
|
37
|
+
- [ ] Strategy framework loaded first
|
|
38
|
+
- [ ] Every line classified (KEEP/REMOVE/RESTRUCTURE/CARL_CANDIDATE)
|
|
39
|
+
- [ ] User approved audit before rewriting began
|
|
40
|
+
- [ ] CARL detection completed, rule routing decided
|
|
41
|
+
- [ ] Each section approved individually
|
|
42
|
+
- [ ] Final CLAUDE.base.md under 100 lines
|
|
43
|
+
- [ ] Original CLAUDE.md untouched
|
|
44
|
+
</success_criteria>
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: base:audit-claude
|
|
3
|
+
description: Audit .qwen/ directories across workspace for sprawl, duplication, and misalignment
|
|
4
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Audit all .qwen/ directories in this workspace. Discover sprawl, classify items against the global/workspace/project hierarchy, and remediate with operator approval at every step.
|
|
9
|
+
|
|
10
|
+
**When to use:** "audit claude config", "clean up .claude dirs", "check claude setup", after installing global tools.
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<execution_context>
|
|
14
|
+
@base-framework/tasks/audit-claude.md
|
|
15
|
+
@base-framework/frameworks/claude-config-alignment.md
|
|
16
|
+
</execution_context>
|
|
17
|
+
|
|
18
|
+
<context>
|
|
19
|
+
$ARGUMENTS
|
|
20
|
+
|
|
21
|
+
Global config: ~/.qwen/
|
|
22
|
+
Workspace root config: .qwen/
|
|
23
|
+
</context>
|
|
24
|
+
|
|
25
|
+
<process>
|
|
26
|
+
Follow task: @base-framework/tasks/audit-claude.md
|
|
27
|
+
|
|
28
|
+
The framework file defines classification rules, safety protocol, and output format.
|
|
29
|
+
The task file defines the step-by-step process.
|
|
30
|
+
|
|
31
|
+
Key principles:
|
|
32
|
+
- Every change requires operator approval
|
|
33
|
+
- Process from lowest risk to highest
|
|
34
|
+
- Never batch-delete without per-item confirmation
|
|
35
|
+
- Explain what, why, and what could go wrong for every change
|
|
36
|
+
- Copy-then-verify-then-remove, never move
|
|
37
|
+
</process>
|
|
38
|
+
|
|
39
|
+
<success_criteria>
|
|
40
|
+
- [ ] All .qwen/ directories discovered and inventoried
|
|
41
|
+
- [ ] Items classified with evidence
|
|
42
|
+
- [ ] Operator confirmed classifications
|
|
43
|
+
- [ ] Remediation executed by risk group with verification
|
|
44
|
+
- [ ] Summary report with manual follow-up items
|
|
45
|
+
</success_criteria>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: base:audit
|
|
3
|
+
description: Deep workspace optimization
|
|
4
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, Agent, AskUserQuestion]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Deep workspace audit — comprehensive optimization across all areas with actionable recommendations.
|
|
9
|
+
|
|
10
|
+
**When to use:** "audit my workspace", "deep clean", monthly optimization.
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<execution_context>
|
|
14
|
+
@{~/.qwen/commands/qwen-base/tasks/audit.md}
|
|
15
|
+
@{~/.qwen/commands/qwen-base/context/base-principles.md}
|
|
16
|
+
@{~/.qwen/commands/qwen-base/frameworks/audit-strategies.md}
|
|
17
|
+
</execution_context>
|
|
18
|
+
|
|
19
|
+
<context>
|
|
20
|
+
$ARGUMENTS
|
|
21
|
+
|
|
22
|
+
@.base/workspace.json
|
|
23
|
+
</context>
|
|
24
|
+
|
|
25
|
+
<process>
|
|
26
|
+
Follow task: @{~/.qwen/commands/qwen-base/tasks/audit.md}
|
|
27
|
+
</process>
|
|
28
|
+
|
|
29
|
+
<success_criteria>
|
|
30
|
+
- [ ] All areas audited with strategy-specific checks
|
|
31
|
+
- [ ] Findings categorized and prioritized
|
|
32
|
+
- [ ] Actionable recommendations presented
|
|
33
|
+
</success_criteria>
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: base:carl-hygiene
|
|
3
|
+
description: CARL domain maintenance and rule review
|
|
4
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion, carl_v2_list_domains, carl_v2_get_domain, carl_v2_get_staged, carl_v2_approve_proposal, carl_v2_remove_rule, carl_v2_replace_rules, carl_v2_archive_decision]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
CARL rule lifecycle management — review staleness, staging pipeline, domain health.
|
|
9
|
+
|
|
10
|
+
**When to use:** "carl hygiene", "review carl rules", "clean up carl".
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<execution_context>
|
|
14
|
+
@{~/.qwen/commands/qwen-base/tasks/carl-hygiene.md}
|
|
15
|
+
</execution_context>
|
|
16
|
+
|
|
17
|
+
<context>
|
|
18
|
+
$ARGUMENTS
|
|
19
|
+
|
|
20
|
+
@.carl/carl.json
|
|
21
|
+
@.base/workspace.json
|
|
22
|
+
</context>
|
|
23
|
+
|
|
24
|
+
<process>
|
|
25
|
+
Follow task: @{~/.qwen/commands/qwen-base/tasks/carl-hygiene.md}
|
|
26
|
+
</process>
|
|
27
|
+
|
|
28
|
+
<success_criteria>
|
|
29
|
+
- [ ] All domains reviewed for staleness
|
|
30
|
+
- [ ] Duplicate/conflicting rules identified
|
|
31
|
+
- [ ] Staging pipeline processed
|
|
32
|
+
- [ ] carl_hygiene.last_run updated in workspace.json
|
|
33
|
+
</success_criteria>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: base:groom
|
|
3
|
+
description: Weekly workspace maintenance cycle
|
|
4
|
+
allowed-tools: [Read, Write, Edit, Glob, Grep, Bash, AskUserQuestion]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Structured weekly maintenance — review each workspace area, update statuses, archive stale items, reduce drift.
|
|
9
|
+
|
|
10
|
+
**When to use:** Weekly maintenance, "groom my workspace", "run grooming".
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<execution_context>
|
|
14
|
+
@{~/.qwen/commands/qwen-base/tasks/groom.md}
|
|
15
|
+
@{~/.qwen/commands/qwen-base/context/base-principles.md}
|
|
16
|
+
@{~/.qwen/commands/qwen-base/frameworks/audit-strategies.md}
|
|
17
|
+
</execution_context>
|
|
18
|
+
|
|
19
|
+
<context>
|
|
20
|
+
$ARGUMENTS
|
|
21
|
+
|
|
22
|
+
@.base/workspace.json
|
|
23
|
+
@.base/data/state.json
|
|
24
|
+
</context>
|
|
25
|
+
|
|
26
|
+
<process>
|
|
27
|
+
Follow task: @{~/.qwen/commands/qwen-base/tasks/groom.md}
|
|
28
|
+
</process>
|
|
29
|
+
|
|
30
|
+
<success_criteria>
|
|
31
|
+
- [ ] All workspace areas reviewed
|
|
32
|
+
- [ ] Stale items addressed
|
|
33
|
+
- [ ] state.json updated with groom results
|
|
34
|
+
- [ ] Drift score recalculated
|
|
35
|
+
</success_criteria>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: base:history
|
|
3
|
+
description: Workspace evolution timeline
|
|
4
|
+
allowed-tools: [Read, Glob, Bash]
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
<objective>
|
|
8
|
+
Show workspace evolution — grooming history, audits, major changes over time.
|
|
9
|
+
|
|
10
|
+
**When to use:** "workspace history", "show evolution", "what's changed".
|
|
11
|
+
</objective>
|
|
12
|
+
|
|
13
|
+
<execution_context>
|
|
14
|
+
@{~/.qwen/commands/qwen-base/tasks/history.md}
|
|
15
|
+
</execution_context>
|
|
16
|
+
|
|
17
|
+
<context>
|
|
18
|
+
@.base/data/state.json
|
|
19
|
+
</context>
|
|
20
|
+
|
|
21
|
+
<process>
|
|
22
|
+
Follow task: @{~/.qwen/commands/qwen-base/tasks/history.md}
|
|
23
|
+
</process>
|
|
24
|
+
|
|
25
|
+
<success_criteria>
|
|
26
|
+
- [ ] Timeline of workspace events displayed
|
|
27
|
+
</success_criteria>
|