claude-code-ultimate-optimal-framework 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 +83 -0
- package/bin/claude-os.js +5 -0
- package/package.json +30 -0
- package/src/init.js +57 -0
- package/src/prompts.js +137 -0
- package/src/scaffold.js +93 -0
- package/src/templates.js +927 -0
package/README.md
ADDED
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
# claude-os
|
|
2
|
+
|
|
3
|
+
Scaffold a Claude Code workspace with routing, memory, and self-updating architecture — in one command.
|
|
4
|
+
|
|
5
|
+
## What It Creates
|
|
6
|
+
|
|
7
|
+
A 3-layer routing system that tells Claude exactly what to load (and what to skip) for every task. Keeps token usage low, memory high, and context relevant.
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
your-workspace/
|
|
11
|
+
├── CLAUDE.md ← Master map (always loaded)
|
|
12
|
+
├── CONTEXT.md ← Task router
|
|
13
|
+
├── PROJECT-REGISTRY.md ← Project index
|
|
14
|
+
├── company/ ← Brand voice, products, SOPs
|
|
15
|
+
├── departments/ ← One workspace per department
|
|
16
|
+
├── products/ ← One workspace per product
|
|
17
|
+
├── projects/ ← Time-bounded initiatives (auto-created)
|
|
18
|
+
└── _system/ ← Infrastructure docs + project templates
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Usage
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
npx claude-os init
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
The CLI will ask you about:
|
|
28
|
+
- Company name, description, tagline, website, industry
|
|
29
|
+
- Which departments exist
|
|
30
|
+
- Products and services
|
|
31
|
+
- VPS or local server infrastructure (optional)
|
|
32
|
+
- Where to create the workspace
|
|
33
|
+
|
|
34
|
+
Then it generates the entire folder structure with customized files.
|
|
35
|
+
|
|
36
|
+
## How the System Works
|
|
37
|
+
|
|
38
|
+
### 3-Layer Routing
|
|
39
|
+
|
|
40
|
+
| Layer | File | Purpose | Size |
|
|
41
|
+
|-------|------|---------|------|
|
|
42
|
+
| 1 | `CLAUDE.md` | Always loaded — the map | ≤200 lines |
|
|
43
|
+
| 2 | `CONTEXT.md` | Task router — where to go | 30-50 lines |
|
|
44
|
+
| 3 | `[workspace]/CONTEXT.md` | Scoped instructions per task | 25-80 lines |
|
|
45
|
+
|
|
46
|
+
### Self-Updating
|
|
47
|
+
|
|
48
|
+
Paste or speak unstructured thoughts and Claude routes them to the right files automatically:
|
|
49
|
+
|
|
50
|
+
- *"Our brand voice is warm but direct..."* → updates `company/voice-brand.md`
|
|
51
|
+
- *"We're launching a new service called X..."* → updates `company/products.md`
|
|
52
|
+
- *"We need a new onboarding process..."* → creates `company/sops/sop-onboarding.md`
|
|
53
|
+
|
|
54
|
+
### Auto-Scaffolding
|
|
55
|
+
|
|
56
|
+
Say `"New project: [describe what you need]"` and Claude:
|
|
57
|
+
1. Infers the project type (biz-initiative / va-workflow / product-build)
|
|
58
|
+
2. Creates the folder structure from the right template
|
|
59
|
+
3. Registers it in `PROJECT-REGISTRY.md` and `CLAUDE.md`
|
|
60
|
+
|
|
61
|
+
### Token Management
|
|
62
|
+
|
|
63
|
+
Every workspace has a **"Skip These"** column — telling Claude what NOT to load. This prevents context bloat on large workspaces.
|
|
64
|
+
|
|
65
|
+
## Local Development
|
|
66
|
+
|
|
67
|
+
```bash
|
|
68
|
+
git clone <this repo>
|
|
69
|
+
cd claude-os
|
|
70
|
+
npm install
|
|
71
|
+
node bin/claude-os.js
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Publishing
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
npm publish
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Requirements
|
|
81
|
+
|
|
82
|
+
- Node.js 18+
|
|
83
|
+
- Claude Code (claude.ai/code)
|
package/bin/claude-os.js
ADDED
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "claude-code-ultimate-optimal-framework",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Scaffold a Claude Code workspace with routing, memory, and self-updating architecture",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"bin": {
|
|
7
|
+
"claude-code-ultimate-optimal-framework": "./bin/claude-os.js"
|
|
8
|
+
},
|
|
9
|
+
"scripts": {
|
|
10
|
+
"dev": "node bin/claude-os.js"
|
|
11
|
+
},
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@inquirer/prompts": "^7.5.0",
|
|
14
|
+
"chalk": "^5.4.1",
|
|
15
|
+
"fs-extra": "^11.3.0"
|
|
16
|
+
},
|
|
17
|
+
"engines": {
|
|
18
|
+
"node": ">=18.0.0"
|
|
19
|
+
},
|
|
20
|
+
"keywords": [
|
|
21
|
+
"claude",
|
|
22
|
+
"claude-code",
|
|
23
|
+
"ai",
|
|
24
|
+
"workspace",
|
|
25
|
+
"scaffold",
|
|
26
|
+
"anthropic"
|
|
27
|
+
],
|
|
28
|
+
"author": "ProSulum",
|
|
29
|
+
"license": "MIT"
|
|
30
|
+
}
|
package/src/init.js
ADDED
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import chalk from 'chalk';
|
|
2
|
+
import { gatherConfig } from './prompts.js';
|
|
3
|
+
import { scaffold } from './scaffold.js';
|
|
4
|
+
|
|
5
|
+
export async function run() {
|
|
6
|
+
try {
|
|
7
|
+
const config = await gatherConfig();
|
|
8
|
+
|
|
9
|
+
console.log(chalk.bold.cyan('\n Building workspace...\n'));
|
|
10
|
+
|
|
11
|
+
const root = await scaffold(config);
|
|
12
|
+
|
|
13
|
+
const deptList = config.departments.map(d => ` • ${d}`).join('\n');
|
|
14
|
+
const productList = config.products.length
|
|
15
|
+
? config.products.map(p => ` • ${p.name} → products/${p.slug}/`).join('\n')
|
|
16
|
+
: ' (none)';
|
|
17
|
+
|
|
18
|
+
console.log(chalk.bold.green(' ✓ Workspace created!\n'));
|
|
19
|
+
console.log(chalk.white(` Location: ${chalk.cyan(root)}\n`));
|
|
20
|
+
|
|
21
|
+
console.log(chalk.bold(' What was created:\n'));
|
|
22
|
+
console.log(` ${chalk.cyan('CLAUDE.md')} — master map (always loaded)`);
|
|
23
|
+
console.log(` ${chalk.cyan('CONTEXT.md')} — task router`);
|
|
24
|
+
console.log(` ${chalk.cyan('PROJECT-REGISTRY.md')} — project index`);
|
|
25
|
+
console.log(` ${chalk.cyan('company/')} — brand, products, SOPs`);
|
|
26
|
+
console.log(` ${chalk.cyan('departments/')} — ${config.departments.length} department workspace(s)`);
|
|
27
|
+
if (deptList) console.log(deptList);
|
|
28
|
+
console.log(` ${chalk.cyan('products/')} — product workspaces`);
|
|
29
|
+
console.log(productList);
|
|
30
|
+
console.log(` ${chalk.cyan('projects/')} — time-bounded projects (auto-created)`);
|
|
31
|
+
console.log(` ${chalk.cyan('_system/')} — infra docs + project templates\n`);
|
|
32
|
+
|
|
33
|
+
console.log(chalk.bold(' Next steps:\n'));
|
|
34
|
+
console.log(` 1. Open the workspace in Claude Code:`);
|
|
35
|
+
console.log(` ${chalk.gray(`claude "${root}"`)}\n`);
|
|
36
|
+
console.log(` 2. Fill in the ${chalk.cyan('[TBD]')} placeholders by pasting or speaking:`);
|
|
37
|
+
console.log(` ${chalk.gray('"Our brand voice is professional but warm..."')}`);
|
|
38
|
+
console.log(` ${chalk.gray('"Our main product is X, which does Y..."')}\n`);
|
|
39
|
+
console.log(` 3. Create your first project:`);
|
|
40
|
+
console.log(` ${chalk.gray('"New project: [describe what you need]"')}\n`);
|
|
41
|
+
|
|
42
|
+
if (config.infra.hasVps) {
|
|
43
|
+
console.log(` 4. Update ${chalk.cyan('_system/infra/vps.md')} with your deployed apps.\n`);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
console.log(chalk.gray(' The workspace is self-updating — dump thoughts, voice notes,'));
|
|
47
|
+
console.log(chalk.gray(' or brain dumps directly into Claude and it will route them.\n'));
|
|
48
|
+
|
|
49
|
+
} catch (err) {
|
|
50
|
+
if (err.name === 'ExitPromptError') {
|
|
51
|
+
console.log(chalk.gray('\n Cancelled.\n'));
|
|
52
|
+
process.exit(0);
|
|
53
|
+
}
|
|
54
|
+
console.error(chalk.red('\n Error: ') + err.message);
|
|
55
|
+
process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
}
|
package/src/prompts.js
ADDED
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { input, checkbox, confirm, select } from '@inquirer/prompts';
|
|
2
|
+
import chalk from 'chalk';
|
|
3
|
+
|
|
4
|
+
const ALL_DEPARTMENTS = [
|
|
5
|
+
{ name: 'Marketing', value: 'marketing' },
|
|
6
|
+
{ name: 'Sales', value: 'sales' },
|
|
7
|
+
{ name: 'Operations', value: 'operations' },
|
|
8
|
+
{ name: 'Networking & BD', value: 'networking' },
|
|
9
|
+
{ name: 'HR & Recruiting', value: 'hr' },
|
|
10
|
+
{ name: 'Finance', value: 'finance' },
|
|
11
|
+
{ name: 'Customer Success', value: 'customer-success' },
|
|
12
|
+
{ name: 'Product', value: 'product' },
|
|
13
|
+
{ name: 'Engineering', value: 'engineering' },
|
|
14
|
+
];
|
|
15
|
+
|
|
16
|
+
export async function gatherConfig() {
|
|
17
|
+
console.log(chalk.bold.cyan('\n Claude OS — Workspace Setup\n'));
|
|
18
|
+
console.log(chalk.gray(' This will scaffold a Claude Code workspace with routing, memory,\n and self-updating architecture.\n'));
|
|
19
|
+
|
|
20
|
+
// --- Company info ---
|
|
21
|
+
console.log(chalk.bold(' Company Info\n'));
|
|
22
|
+
|
|
23
|
+
const companyName = await input({
|
|
24
|
+
message: 'Company name:',
|
|
25
|
+
validate: v => v.trim().length > 0 || 'Required',
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
const companyDescription = await input({
|
|
29
|
+
message: 'What does the company do? (1-2 sentences):',
|
|
30
|
+
validate: v => v.trim().length > 0 || 'Required',
|
|
31
|
+
});
|
|
32
|
+
|
|
33
|
+
const companyTagline = await input({
|
|
34
|
+
message: 'Tagline or value prop (optional — press Enter to skip):',
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
const companyWebsite = await input({
|
|
38
|
+
message: 'Website (optional):',
|
|
39
|
+
});
|
|
40
|
+
|
|
41
|
+
const industry = await input({
|
|
42
|
+
message: 'Industry or niche:',
|
|
43
|
+
validate: v => v.trim().length > 0 || 'Required',
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
// --- Departments ---
|
|
47
|
+
console.log(chalk.bold('\n Departments\n'));
|
|
48
|
+
|
|
49
|
+
const selectedDepts = await checkbox({
|
|
50
|
+
message: 'Which departments does this company have?',
|
|
51
|
+
choices: ALL_DEPARTMENTS,
|
|
52
|
+
instructions: ' Space to select · Enter to confirm',
|
|
53
|
+
});
|
|
54
|
+
|
|
55
|
+
const customDeptInput = await input({
|
|
56
|
+
message: 'Custom departments? (comma-separated, or Enter to skip):',
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
const customDepts = customDeptInput
|
|
60
|
+
.split(',')
|
|
61
|
+
.map(d => d.trim().toLowerCase().replace(/\s+/g, '-'))
|
|
62
|
+
.filter(Boolean);
|
|
63
|
+
|
|
64
|
+
const departments = [...selectedDepts, ...customDepts];
|
|
65
|
+
|
|
66
|
+
// --- Products ---
|
|
67
|
+
console.log(chalk.bold('\n Products & Services\n'));
|
|
68
|
+
|
|
69
|
+
const addProducts = await confirm({
|
|
70
|
+
message: 'Add products or services now?',
|
|
71
|
+
default: true,
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const products = [];
|
|
75
|
+
if (addProducts) {
|
|
76
|
+
let addMore = true;
|
|
77
|
+
while (addMore) {
|
|
78
|
+
const productName = await input({
|
|
79
|
+
message: `Product/service name:`,
|
|
80
|
+
validate: v => v.trim().length > 0 || 'Required',
|
|
81
|
+
});
|
|
82
|
+
const productDescription = await input({
|
|
83
|
+
message: `Short description:`,
|
|
84
|
+
});
|
|
85
|
+
const productSlug = productName.toLowerCase().replace(/\s+/g, '-').replace(/[^a-z0-9-]/g, '');
|
|
86
|
+
products.push({ name: productName, slug: productSlug, description: productDescription });
|
|
87
|
+
|
|
88
|
+
addMore = await confirm({ message: 'Add another product/service?', default: false });
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
// --- Infrastructure ---
|
|
93
|
+
console.log(chalk.bold('\n Infrastructure\n'));
|
|
94
|
+
|
|
95
|
+
const hasVps = await confirm({ message: 'Does this client have a VPS for app deployment?', default: false });
|
|
96
|
+
let vpsHost = '';
|
|
97
|
+
let vpsSshAlias = '';
|
|
98
|
+
if (hasVps) {
|
|
99
|
+
vpsHost = await input({ message: 'VPS IP or hostname:' });
|
|
100
|
+
vpsSshAlias = await input({ message: 'SSH alias (from ~/.ssh/config):' });
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
const hasLocalServer = await confirm({ message: 'Does this client have an always-on local machine (Mac Mini, NUC, etc.)?', default: false });
|
|
104
|
+
let localServerName = '';
|
|
105
|
+
if (hasLocalServer) {
|
|
106
|
+
localServerName = await input({ message: 'What is it called? (e.g. "Mac Mini"):' });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// --- Output directory ---
|
|
110
|
+
console.log(chalk.bold('\n Output\n'));
|
|
111
|
+
|
|
112
|
+
const outputDir = await input({
|
|
113
|
+
message: 'Where should the workspace be created? (full path or . for current directory):',
|
|
114
|
+
default: '.',
|
|
115
|
+
});
|
|
116
|
+
|
|
117
|
+
return {
|
|
118
|
+
company: {
|
|
119
|
+
name: companyName.trim(),
|
|
120
|
+
description: companyDescription.trim(),
|
|
121
|
+
tagline: companyTagline.trim(),
|
|
122
|
+
website: companyWebsite.trim(),
|
|
123
|
+
industry: industry.trim(),
|
|
124
|
+
date: new Date().toISOString().split('T')[0],
|
|
125
|
+
},
|
|
126
|
+
departments,
|
|
127
|
+
products,
|
|
128
|
+
infra: {
|
|
129
|
+
hasVps,
|
|
130
|
+
vpsHost,
|
|
131
|
+
vpsSshAlias,
|
|
132
|
+
hasLocalServer,
|
|
133
|
+
localServerName,
|
|
134
|
+
},
|
|
135
|
+
outputDir: outputDir.trim(),
|
|
136
|
+
};
|
|
137
|
+
}
|
package/src/scaffold.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import path from 'path';
|
|
2
|
+
import fs from 'fs-extra';
|
|
3
|
+
import {
|
|
4
|
+
generateClaudeMd,
|
|
5
|
+
generateContextMd,
|
|
6
|
+
generateProjectRegistry,
|
|
7
|
+
generateCompanyContextMd,
|
|
8
|
+
generateVoiceBrand,
|
|
9
|
+
generateProductsMd,
|
|
10
|
+
generateDeptContextMd,
|
|
11
|
+
generateProductContextMd,
|
|
12
|
+
generateSystemContextMd,
|
|
13
|
+
generateVpsMd,
|
|
14
|
+
generateLocalServerMd,
|
|
15
|
+
generateBizInitiativeTemplateMd,
|
|
16
|
+
generateVaWorkflowTemplateMd,
|
|
17
|
+
generateProductBuildTemplateMd,
|
|
18
|
+
} from './templates.js';
|
|
19
|
+
|
|
20
|
+
export async function scaffold(config) {
|
|
21
|
+
const root = config.outputDir === '.'
|
|
22
|
+
? process.cwd()
|
|
23
|
+
: path.resolve(config.outputDir);
|
|
24
|
+
|
|
25
|
+
const write = async (relPath, content) => {
|
|
26
|
+
const fullPath = path.join(root, relPath);
|
|
27
|
+
await fs.ensureDir(path.dirname(fullPath));
|
|
28
|
+
await fs.writeFile(fullPath, content, 'utf8');
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const mkdir = async (relPath) => {
|
|
32
|
+
await fs.ensureDir(path.join(root, relPath));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
// ── Root files ──
|
|
36
|
+
await write('CLAUDE.md', generateClaudeMd(config));
|
|
37
|
+
await write('CONTEXT.md', generateContextMd(config));
|
|
38
|
+
await write('PROJECT-REGISTRY.md', generateProjectRegistry(config));
|
|
39
|
+
|
|
40
|
+
// ── company/ ──
|
|
41
|
+
await write('company/CONTEXT.md', generateCompanyContextMd(config));
|
|
42
|
+
await write('company/voice-brand.md', generateVoiceBrand(config));
|
|
43
|
+
await write('company/products.md', generateProductsMd(config));
|
|
44
|
+
await mkdir('company/sops');
|
|
45
|
+
|
|
46
|
+
// ── departments/ ──
|
|
47
|
+
for (const dept of config.departments) {
|
|
48
|
+
await write(`departments/${dept}/CONTEXT.md`, generateDeptContextMd(dept, config));
|
|
49
|
+
await mkdir(`departments/${dept}/assets`);
|
|
50
|
+
await mkdir(`departments/${dept}/output`);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// ── products/ ──
|
|
54
|
+
for (const product of config.products) {
|
|
55
|
+
await write(`products/${product.slug}/CONTEXT.md`, generateProductContextMd(product, config));
|
|
56
|
+
await mkdir(`products/${product.slug}/specs`);
|
|
57
|
+
await mkdir(`products/${product.slug}/assets`);
|
|
58
|
+
await mkdir(`products/${product.slug}/output`);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
// ── projects/ ──
|
|
62
|
+
await mkdir('projects');
|
|
63
|
+
|
|
64
|
+
// ── _system/ ──
|
|
65
|
+
await write('_system/CONTEXT.md', generateSystemContextMd(config));
|
|
66
|
+
await mkdir('_system/infra');
|
|
67
|
+
|
|
68
|
+
if (config.infra.hasVps) {
|
|
69
|
+
await write('_system/infra/vps.md', generateVpsMd(config));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
if (config.infra.hasLocalServer) {
|
|
73
|
+
const slug = (config.infra.localServerName || 'local-server')
|
|
74
|
+
.toLowerCase().replace(/\s+/g, '-');
|
|
75
|
+
await write(`_system/infra/${slug}.md`, generateLocalServerMd(config));
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// ── _system/templates/ ──
|
|
79
|
+
await write('_system/templates/biz-initiative/CONTEXT.md', generateBizInitiativeTemplateMd());
|
|
80
|
+
await mkdir('_system/templates/biz-initiative/assets');
|
|
81
|
+
await mkdir('_system/templates/biz-initiative/output');
|
|
82
|
+
|
|
83
|
+
await write('_system/templates/va-workflow/CONTEXT.md', generateVaWorkflowTemplateMd());
|
|
84
|
+
await mkdir('_system/templates/va-workflow/assets');
|
|
85
|
+
await mkdir('_system/templates/va-workflow/output');
|
|
86
|
+
|
|
87
|
+
await write('_system/templates/product-build/CONTEXT.md', generateProductBuildTemplateMd());
|
|
88
|
+
await mkdir('_system/templates/product-build/specs');
|
|
89
|
+
await mkdir('_system/templates/product-build/assets');
|
|
90
|
+
await mkdir('_system/templates/product-build/output');
|
|
91
|
+
|
|
92
|
+
return root;
|
|
93
|
+
}
|
package/src/templates.js
ADDED
|
@@ -0,0 +1,927 @@
|
|
|
1
|
+
// All workspace file generators. Each function takes a config object and returns a string.
|
|
2
|
+
|
|
3
|
+
const toTitle = str => str.replace(/-/g, ' ').replace(/\b\w/g, c => c.toUpperCase());
|
|
4
|
+
|
|
5
|
+
// ─── CLAUDE.md ───────────────────────────────────────────────────────────────
|
|
6
|
+
|
|
7
|
+
export function generateClaudeMd(config) {
|
|
8
|
+
const { company, departments, products } = config;
|
|
9
|
+
const deptRows = departments.map(d => `│ ├── ${d}/`).join('\n');
|
|
10
|
+
const productRows = products.length
|
|
11
|
+
? products.map(p => `│ ├── ${p.slug}/`).join('\n')
|
|
12
|
+
: '│ └── (add products as you build them)';
|
|
13
|
+
|
|
14
|
+
const navRows = [
|
|
15
|
+
'| **Capture scattered thoughts / voice notes** | Paste here — I will route and update automatically |',
|
|
16
|
+
'| **Create a new project** | Say: "New project: [description]" |',
|
|
17
|
+
'| **Write marketing copy or campaigns** | `departments/marketing/CONTEXT.md` |',
|
|
18
|
+
'| **Work on a sales process or pipeline** | `departments/sales/CONTEXT.md` |',
|
|
19
|
+
'| **Design a client workflow or SOP** | `departments/operations/CONTEXT.md` |',
|
|
20
|
+
...departments.filter(d => !['marketing','sales','operations'].includes(d)).map(d =>
|
|
21
|
+
`| **${toTitle(d)} work** | \`departments/${d}/CONTEXT.md\` |`
|
|
22
|
+
),
|
|
23
|
+
...products.map(p => `| **${p.name} product work** | \`products/${p.slug}/CONTEXT.md\` |`),
|
|
24
|
+
].join('\n');
|
|
25
|
+
|
|
26
|
+
const infraSection = config.infra.hasVps || config.infra.hasLocalServer ? `
|
|
27
|
+
## Devices & Sync
|
|
28
|
+
|
|
29
|
+
| Device | Role | Sync |
|
|
30
|
+
|--------|------|------|
|
|
31
|
+
| Primary machine | Development & operations | Full Dropbox |${config.infra.hasVps ? `\n| VPS (${config.infra.vpsHost || 'TBD'}) | Web app deployment | Git only |` : ''}${config.infra.hasLocalServer ? `\n| ${config.infra.localServerName || 'Local Server'} | Always-on automation | Selective sync |` : ''}
|
|
32
|
+
|
|
33
|
+
---
|
|
34
|
+
` : '';
|
|
35
|
+
|
|
36
|
+
return `# ${company.name} — Workspace Map
|
|
37
|
+
|
|
38
|
+
## What This Is
|
|
39
|
+
|
|
40
|
+
${company.description}${company.tagline ? `\n\n*${company.tagline}*` : ''}
|
|
41
|
+
|
|
42
|
+
A workspace system for ${company.name}. An agent drops into a workspace, reads its CONTEXT.md, does its work, and exits.
|
|
43
|
+
|
|
44
|
+
**CONTEXT.md** (top-level) routes you to the right workspace. This file is the map.
|
|
45
|
+
|
|
46
|
+
---
|
|
47
|
+
|
|
48
|
+
## Folder Structure
|
|
49
|
+
|
|
50
|
+
\`\`\`
|
|
51
|
+
workspace/
|
|
52
|
+
├── CLAUDE.md ← You are here (always loaded)
|
|
53
|
+
├── CONTEXT.md ← Task router
|
|
54
|
+
├── PROJECT-REGISTRY.md ← Index of all active projects
|
|
55
|
+
│
|
|
56
|
+
├── company/ ← Evergreen company knowledge
|
|
57
|
+
│ ├── CONTEXT.md
|
|
58
|
+
│ ├── voice-brand.md ← Brand voice, tone, messaging rules
|
|
59
|
+
│ ├── products.md ← Product catalog
|
|
60
|
+
│ └── sops/ ← Internal SOPs (add as created)
|
|
61
|
+
│
|
|
62
|
+
├── departments/ ← Department workspaces
|
|
63
|
+
${deptRows}
|
|
64
|
+
│
|
|
65
|
+
├── products/ ← Product-specific workspaces
|
|
66
|
+
${productRows}
|
|
67
|
+
│
|
|
68
|
+
├── projects/ ← Time-bounded initiatives
|
|
69
|
+
│ └── (auto-created per project)
|
|
70
|
+
│
|
|
71
|
+
└── _system/ ← Infrastructure & templates
|
|
72
|
+
├── CONTEXT.md
|
|
73
|
+
├── infra/
|
|
74
|
+
${config.infra.hasVps ? ' │ ├── vps.md\n' : ''}${config.infra.hasLocalServer ? ` │ └── ${config.infra.localServerName?.toLowerCase().replace(/\s+/g,'-') || 'local-server'}.md\n` : ''} └── templates/
|
|
75
|
+
├── biz-initiative/
|
|
76
|
+
├── va-workflow/
|
|
77
|
+
└── product-build/
|
|
78
|
+
\`\`\`
|
|
79
|
+
|
|
80
|
+
---
|
|
81
|
+
|
|
82
|
+
## Quick Navigation
|
|
83
|
+
|
|
84
|
+
| Want to... | Go here |
|
|
85
|
+
|------------|---------|
|
|
86
|
+
${navRows}
|
|
87
|
+
| **Write or edit a company SOP** | \`company/CONTEXT.md\` |
|
|
88
|
+
| **Check or update infrastructure** | \`_system/CONTEXT.md\` |
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Active Projects
|
|
93
|
+
|
|
94
|
+
| Slug | Type | Department | Status | Path |
|
|
95
|
+
|------|------|-----------|--------|------|
|
|
96
|
+
| (none yet — projects auto-registered here) | | | | |
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
## New Project Creation
|
|
101
|
+
|
|
102
|
+
When I say **"New project: [description]"**:
|
|
103
|
+
1. Parse → infer type (biz-initiative / va-workflow / product-build), department, and a slug
|
|
104
|
+
2. Copy the matching template from \`_system/templates/\`
|
|
105
|
+
3. Create \`projects/[slug]/\` with the template files
|
|
106
|
+
4. Add a row to **Active Projects** above and to \`PROJECT-REGISTRY.md\`
|
|
107
|
+
5. Confirm what was created
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Naming Conventions
|
|
112
|
+
|
|
113
|
+
| Content Type | Pattern | Example |
|
|
114
|
+
|-------------|---------|---------|
|
|
115
|
+
| Project folders | \`[slug]/\` | \`q2-newsletter-campaign/\` |
|
|
116
|
+
| Deliverables | \`[slug]-v[n].[ext]\` | \`onboarding-sop-v2.docx\` |
|
|
117
|
+
| SOPs | \`sop-[process].md\` | \`sop-client-onboarding.md\` |
|
|
118
|
+
| Newsletters | \`[YYYY-MM-DD]-[slug].md\` | \`2026-03-10-launch-week.md\` |
|
|
119
|
+
| Social posts | \`[platform]-[slug].md\` | \`linkedin-launch-announce.md\` |
|
|
120
|
+
|
|
121
|
+
**Statuses:** \`draft\` → \`review\` → \`final\`
|
|
122
|
+
|
|
123
|
+
---
|
|
124
|
+
|
|
125
|
+
## Token Rules
|
|
126
|
+
|
|
127
|
+
**Each workspace is siloed.** Don't load everything.
|
|
128
|
+
|
|
129
|
+
- Writing copy? → Load \`company/voice-brand.md\`. Skip everything else.
|
|
130
|
+
- Department task? → Load that department's CONTEXT.md. Skip other departments.
|
|
131
|
+
- Infrastructure work? → Load \`_system/infra/\`. Skip company docs.
|
|
132
|
+
|
|
133
|
+
The CONTEXT.md files tell you what to load per task. Trust them.
|
|
134
|
+
|
|
135
|
+
---
|
|
136
|
+
${infraSection}
|
|
137
|
+
## Update Protocol
|
|
138
|
+
|
|
139
|
+
The workspace is **self-updating and self-generating**. When given unstructured input (voice notes, brain dumps, scattered thoughts):
|
|
140
|
+
|
|
141
|
+
### Routing Table
|
|
142
|
+
|
|
143
|
+
| Information Type | Update These Files |
|
|
144
|
+
|-----------------|-------------------|
|
|
145
|
+
| Brand voice, tone, audience, messaging | \`company/voice-brand.md\` |
|
|
146
|
+
| Product description, features, positioning | \`company/products.md\` |
|
|
147
|
+
| How a department functions | \`departments/[dept]/CONTEXT.md\` |
|
|
148
|
+
| A business process or repeatable workflow | \`company/sops/sop-[process].md\` (create if new) |
|
|
149
|
+
| New product or major tool | \`company/products.md\` + \`products/[name]/CONTEXT.md\` |
|
|
150
|
+
| Infrastructure or tech changes | \`_system/infra/\` files |
|
|
151
|
+
| New project need | Trigger New Project flow (see above) |
|
|
152
|
+
|
|
153
|
+
### Steps
|
|
154
|
+
1. **Parse** — extract key facts, discard filler words
|
|
155
|
+
2. **Route** — identify which file(s) this belongs in
|
|
156
|
+
3. **Edit surgically** — fill \`[TBD]\` placeholders, never erase existing content
|
|
157
|
+
4. **Propagate** — if update affects other files, update those too
|
|
158
|
+
5. **Confirm** — tell user what changed and where
|
|
159
|
+
`;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
// ─── CONTEXT.md (root task router) ───────────────────────────────────────────
|
|
163
|
+
|
|
164
|
+
export function generateContextMd(config) {
|
|
165
|
+
const { company, departments } = config;
|
|
166
|
+
const deptRows = departments.map(d =>
|
|
167
|
+
`| ${toTitle(d)} work | \`departments/${d}/CONTEXT.md\` | \`company/voice-brand.md\` (if writing) |`
|
|
168
|
+
).join('\n');
|
|
169
|
+
|
|
170
|
+
return `# ${company.name} — Task Router
|
|
171
|
+
|
|
172
|
+
Read this at the start of every session to find the right workspace.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Task → Workspace
|
|
177
|
+
|
|
178
|
+
| Task | Load | Also Load |
|
|
179
|
+
|------|------|-----------|
|
|
180
|
+
| Unstructured voice/text input | Stay here — run Update Protocol | Nothing |
|
|
181
|
+
| New project scaffolding | Stay here — run New Project flow | \`_system/templates/\` |
|
|
182
|
+
| Company voice / brand | \`company/CONTEXT.md\` | \`company/voice-brand.md\` |
|
|
183
|
+
| Product info | \`company/CONTEXT.md\` | \`company/products.md\` |
|
|
184
|
+
${deptRows}
|
|
185
|
+
| Infrastructure / deployment | \`_system/CONTEXT.md\` | Relevant \`_system/infra/\` file |
|
|
186
|
+
|
|
187
|
+
---
|
|
188
|
+
|
|
189
|
+
## Cross-Workspace Flow (One-Way)
|
|
190
|
+
|
|
191
|
+
\`\`\`
|
|
192
|
+
company/ (brand + products)
|
|
193
|
+
↓
|
|
194
|
+
departments/ (tactics + operations)
|
|
195
|
+
↓
|
|
196
|
+
products/ (build + ship)
|
|
197
|
+
↓
|
|
198
|
+
_system/infra/ (deploy)
|
|
199
|
+
\`\`\`
|
|
200
|
+
|
|
201
|
+
Context flows downstream only. A department agent never needs to know about infrastructure.
|
|
202
|
+
|
|
203
|
+
---
|
|
204
|
+
|
|
205
|
+
## What NOT to Load
|
|
206
|
+
|
|
207
|
+
- Don't load all department CONTEXT.md files at once — pick the one relevant to the task
|
|
208
|
+
- Don't load \`_system/infra/\` unless doing deployment work
|
|
209
|
+
- Don't load \`company/voice-brand.md\` unless writing copy
|
|
210
|
+
`;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
// ─── PROJECT-REGISTRY.md ──────────────────────────────────────────────────────
|
|
214
|
+
|
|
215
|
+
export function generateProjectRegistry(config) {
|
|
216
|
+
return `# Project Registry
|
|
217
|
+
|
|
218
|
+
Index of all time-bounded projects. Rows are auto-appended during project creation.
|
|
219
|
+
|
|
220
|
+
| Slug | Type | Department | Status | Path | Created | Notes |
|
|
221
|
+
|------|------|-----------|--------|------|---------|-------|
|
|
222
|
+
`;
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
// ─── company/CONTEXT.md ───────────────────────────────────────────────────────
|
|
226
|
+
|
|
227
|
+
export function generateCompanyContextMd(config) {
|
|
228
|
+
return `# Company Knowledge
|
|
229
|
+
|
|
230
|
+
## When to Load What
|
|
231
|
+
|
|
232
|
+
| Task | Load | Skip |
|
|
233
|
+
|------|------|------|
|
|
234
|
+
| Writing any copy or messaging | \`voice-brand.md\` | \`products.md\`, SOPs |
|
|
235
|
+
| Referencing products / services | \`products.md\` | \`voice-brand.md\` |
|
|
236
|
+
| Writing about a business process | Specific SOP from \`sops/\` | Everything else |
|
|
237
|
+
| Both copy + product context | Both | SOPs |
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
## Folder Contents
|
|
242
|
+
|
|
243
|
+
- \`voice-brand.md\` — Tone, personality, messaging rules, audience profiles
|
|
244
|
+
- \`products.md\` — Product catalog, descriptions, positioning
|
|
245
|
+
- \`sops/\` — Internal SOPs (created as processes are documented)
|
|
246
|
+
|
|
247
|
+
---
|
|
248
|
+
|
|
249
|
+
## SOP Naming
|
|
250
|
+
|
|
251
|
+
\`sop-[process].md\` — e.g., \`sop-client-onboarding.md\`, \`sop-weekly-reporting.md\`
|
|
252
|
+
`;
|
|
253
|
+
}
|
|
254
|
+
|
|
255
|
+
// ─── company/voice-brand.md ───────────────────────────────────────────────────
|
|
256
|
+
|
|
257
|
+
export function generateVoiceBrand(config) {
|
|
258
|
+
const { company } = config;
|
|
259
|
+
return `# ${company.name} — Brand Voice & Messaging
|
|
260
|
+
|
|
261
|
+
**Last updated:** ${company.date}
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Company Overview
|
|
266
|
+
|
|
267
|
+
**What we do:** ${company.description}
|
|
268
|
+
${company.tagline ? `**Tagline:** ${company.tagline}` : '**Tagline:** [TBD]'}
|
|
269
|
+
**Industry:** ${company.industry}
|
|
270
|
+
**Website:** ${company.website || '[TBD]'}
|
|
271
|
+
|
|
272
|
+
---
|
|
273
|
+
|
|
274
|
+
## Brand Voice
|
|
275
|
+
|
|
276
|
+
**Tone:** [TBD — e.g., professional but approachable, confident, direct]
|
|
277
|
+
|
|
278
|
+
**Personality traits:**
|
|
279
|
+
- [TBD]
|
|
280
|
+
- [TBD]
|
|
281
|
+
- [TBD]
|
|
282
|
+
|
|
283
|
+
**We sound like:** [TBD — describe the voice in 1 sentence]
|
|
284
|
+
|
|
285
|
+
**We never sound:** [TBD — what to avoid]
|
|
286
|
+
|
|
287
|
+
---
|
|
288
|
+
|
|
289
|
+
## Messaging Rules
|
|
290
|
+
|
|
291
|
+
**Core value proposition:** [TBD]
|
|
292
|
+
|
|
293
|
+
**Key messages:**
|
|
294
|
+
1. [TBD]
|
|
295
|
+
2. [TBD]
|
|
296
|
+
3. [TBD]
|
|
297
|
+
|
|
298
|
+
**Words we use:** [TBD]
|
|
299
|
+
**Words we avoid:** [TBD]
|
|
300
|
+
|
|
301
|
+
---
|
|
302
|
+
|
|
303
|
+
## Audience Profiles
|
|
304
|
+
|
|
305
|
+
### Primary Audience
|
|
306
|
+
- **Who:** [TBD]
|
|
307
|
+
- **Pain point:** [TBD]
|
|
308
|
+
- **What they want:** [TBD]
|
|
309
|
+
- **How we talk to them:** [TBD]
|
|
310
|
+
|
|
311
|
+
### Secondary Audience
|
|
312
|
+
- **Who:** [TBD]
|
|
313
|
+
- **Pain point:** [TBD]
|
|
314
|
+
|
|
315
|
+
---
|
|
316
|
+
|
|
317
|
+
## Channel-Specific Notes
|
|
318
|
+
|
|
319
|
+
| Channel | Tone Adjustment | Format |
|
|
320
|
+
|---------|----------------|--------|
|
|
321
|
+
| LinkedIn | [TBD] | [TBD] |
|
|
322
|
+
| Email | [TBD] | [TBD] |
|
|
323
|
+
| Website | [TBD] | [TBD] |
|
|
324
|
+
| Proposals | [TBD] | [TBD] |
|
|
325
|
+
`;
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// ─── company/products.md ──────────────────────────────────────────────────────
|
|
329
|
+
|
|
330
|
+
export function generateProductsMd(config) {
|
|
331
|
+
const { company, products } = config;
|
|
332
|
+
|
|
333
|
+
const productSections = products.length
|
|
334
|
+
? products.map(p => `
|
|
335
|
+
## ${p.name}
|
|
336
|
+
|
|
337
|
+
**Slug:** \`${p.slug}\`
|
|
338
|
+
**Description:** ${p.description || '[TBD]'}
|
|
339
|
+
**Status:** [TBD — e.g., active, in development, sunsetting]
|
|
340
|
+
**Target customer:** [TBD]
|
|
341
|
+
**Key differentiator:** [TBD]
|
|
342
|
+
**Pricing:** [TBD]
|
|
343
|
+
`).join('\n---\n')
|
|
344
|
+
: `
|
|
345
|
+
## [Product Name]
|
|
346
|
+
|
|
347
|
+
**Slug:** \`[slug]\`
|
|
348
|
+
**Description:** [TBD]
|
|
349
|
+
**Status:** [TBD]
|
|
350
|
+
**Target customer:** [TBD]
|
|
351
|
+
**Key differentiator:** [TBD]
|
|
352
|
+
**Pricing:** [TBD]
|
|
353
|
+
`;
|
|
354
|
+
|
|
355
|
+
return `# ${company.name} — Products & Services
|
|
356
|
+
|
|
357
|
+
**Last updated:** ${company.date}
|
|
358
|
+
|
|
359
|
+
---
|
|
360
|
+
${productSections}
|
|
361
|
+
`;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
// ─── departments/[dept]/CONTEXT.md ────────────────────────────────────────────
|
|
365
|
+
|
|
366
|
+
const DEPT_DETAILS = {
|
|
367
|
+
marketing: {
|
|
368
|
+
tasks: [
|
|
369
|
+
['Write copy or campaign content', '`company/voice-brand.md`', 'All other docs'],
|
|
370
|
+
['Research trends or competitors', 'None — use Web Search', 'Company docs'],
|
|
371
|
+
['Create social posts', '`company/voice-brand.md`', 'Dept docs'],
|
|
372
|
+
['Build a campaign strategy', '`company/products.md`, `voice-brand.md`', 'Infra docs'],
|
|
373
|
+
],
|
|
374
|
+
tools: [
|
|
375
|
+
['Web Search MCP', 'Research, trend analysis, competitor intel'],
|
|
376
|
+
['`/docx`', 'Written deliverables, campaign briefs'],
|
|
377
|
+
['`/pptx`', 'Presentations and pitch decks'],
|
|
378
|
+
],
|
|
379
|
+
goal: 'Generate awareness and qualified leads.',
|
|
380
|
+
},
|
|
381
|
+
sales: {
|
|
382
|
+
tasks: [
|
|
383
|
+
['Write outreach or follow-up copy', '`company/voice-brand.md`', 'Infra docs'],
|
|
384
|
+
['Build a sales process or playbook', '`company/products.md`', 'Dept docs'],
|
|
385
|
+
['Research a prospect', 'None — use Web Search', 'All docs'],
|
|
386
|
+
['Create a proposal', '`company/products.md`, `voice-brand.md`', 'Infra docs'],
|
|
387
|
+
],
|
|
388
|
+
tools: [
|
|
389
|
+
['Web Search MCP', 'Prospect research, company intel'],
|
|
390
|
+
['`/docx`', 'Proposals, follow-up documents'],
|
|
391
|
+
],
|
|
392
|
+
goal: 'Convert prospects into clients.',
|
|
393
|
+
},
|
|
394
|
+
operations: {
|
|
395
|
+
tasks: [
|
|
396
|
+
['Design a client workflow', '1-2 relevant SOPs from `company/sops/`', 'Marketing/sales docs'],
|
|
397
|
+
['Write an SOP', '1-2 relevant SOPs from `company/sops/`', 'All other docs'],
|
|
398
|
+
['Prepare a client deliverable', 'None', 'All docs'],
|
|
399
|
+
['Review / revise an SOP', 'The specific SOP being revised', 'All other docs'],
|
|
400
|
+
],
|
|
401
|
+
tools: [
|
|
402
|
+
['`/docx`', 'Formatted SOPs and process docs'],
|
|
403
|
+
['`/pdf`', 'Final client deliveries'],
|
|
404
|
+
],
|
|
405
|
+
goal: 'Design and document efficient processes.',
|
|
406
|
+
},
|
|
407
|
+
networking: {
|
|
408
|
+
tasks: [
|
|
409
|
+
['Find networking events', 'None — use Web Search', 'All docs'],
|
|
410
|
+
['Write outreach messages', '`company/voice-brand.md`', 'Infra docs'],
|
|
411
|
+
['Build a BD strategy', '`company/products.md`, `voice-brand.md`', 'Dept docs'],
|
|
412
|
+
],
|
|
413
|
+
tools: [
|
|
414
|
+
['Web Search MCP', 'Event discovery, contact research'],
|
|
415
|
+
['`/docx`', 'Outreach templates, BD plans'],
|
|
416
|
+
],
|
|
417
|
+
goal: 'Build strategic relationships and partnerships.',
|
|
418
|
+
},
|
|
419
|
+
hr: {
|
|
420
|
+
tasks: [
|
|
421
|
+
['Write a job posting', '`company/voice-brand.md`', 'Infra docs'],
|
|
422
|
+
['Build a recruiting process', '`company/sops/`', 'All other docs'],
|
|
423
|
+
['Draft an HR policy', '1-2 relevant SOPs', 'All other docs'],
|
|
424
|
+
],
|
|
425
|
+
tools: [
|
|
426
|
+
['`/docx`', 'Job descriptions, HR docs'],
|
|
427
|
+
],
|
|
428
|
+
goal: 'Attract, hire, and retain great people.',
|
|
429
|
+
},
|
|
430
|
+
finance: {
|
|
431
|
+
tasks: [
|
|
432
|
+
['Build a financial model', 'None', 'All docs'],
|
|
433
|
+
['Write financial copy', '`company/voice-brand.md`', 'Infra docs'],
|
|
434
|
+
['Create a report', 'None', 'All docs'],
|
|
435
|
+
],
|
|
436
|
+
tools: [
|
|
437
|
+
['`/docx`', 'Financial reports, summaries'],
|
|
438
|
+
],
|
|
439
|
+
goal: 'Maintain financial clarity and health.',
|
|
440
|
+
},
|
|
441
|
+
'customer-success': {
|
|
442
|
+
tasks: [
|
|
443
|
+
['Write client-facing communication', '`company/voice-brand.md`', 'Infra docs'],
|
|
444
|
+
['Document a client process', '`company/sops/`', 'All other docs'],
|
|
445
|
+
['Build an onboarding flow', '`company/products.md`, `voice-brand.md`', 'Dept docs'],
|
|
446
|
+
],
|
|
447
|
+
tools: [
|
|
448
|
+
['`/docx`', 'Onboarding docs, client guides'],
|
|
449
|
+
],
|
|
450
|
+
goal: 'Ensure clients succeed and stay.',
|
|
451
|
+
},
|
|
452
|
+
product: {
|
|
453
|
+
tasks: [
|
|
454
|
+
['Define product requirements', '`company/products.md`', 'Infra docs'],
|
|
455
|
+
['Write product copy', '`company/voice-brand.md`, `products.md`', 'Dept docs'],
|
|
456
|
+
['Plan a feature', '`company/products.md`', 'All other docs'],
|
|
457
|
+
],
|
|
458
|
+
tools: [
|
|
459
|
+
['Web Search MCP', 'Competitive research, user research'],
|
|
460
|
+
['`/docx`', 'PRDs, feature specs'],
|
|
461
|
+
],
|
|
462
|
+
goal: 'Define and evolve the product.',
|
|
463
|
+
},
|
|
464
|
+
engineering: {
|
|
465
|
+
tasks: [
|
|
466
|
+
['Build a feature', 'Relevant `products/[name]/CONTEXT.md`', 'Company/dept docs'],
|
|
467
|
+
['Deploy an app', '`_system/infra/vps.md`', 'Company docs'],
|
|
468
|
+
['Review code or architecture', 'Relevant product CONTEXT.md', 'All other docs'],
|
|
469
|
+
],
|
|
470
|
+
tools: [
|
|
471
|
+
['Web Search MCP', 'Library docs, API references'],
|
|
472
|
+
['`_system/infra/vps.md`', 'VPS deployment pattern'],
|
|
473
|
+
],
|
|
474
|
+
goal: 'Build and maintain reliable software.',
|
|
475
|
+
},
|
|
476
|
+
};
|
|
477
|
+
|
|
478
|
+
function getDefaultDeptDetails(dept) {
|
|
479
|
+
return {
|
|
480
|
+
tasks: [
|
|
481
|
+
['Main task', 'Relevant files only', 'All other docs'],
|
|
482
|
+
['Writing deliverables', '`company/voice-brand.md`', 'Infra docs'],
|
|
483
|
+
],
|
|
484
|
+
tools: [
|
|
485
|
+
['`/docx`', 'Written deliverables'],
|
|
486
|
+
['Web Search MCP', 'Research'],
|
|
487
|
+
],
|
|
488
|
+
goal: `[TBD — define the goal for ${toTitle(dept)}]`,
|
|
489
|
+
};
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
export function generateDeptContextMd(dept, config) {
|
|
493
|
+
const details = DEPT_DETAILS[dept] || getDefaultDeptDetails(dept);
|
|
494
|
+
const taskRows = details.tasks.map(([task, load, skip]) =>
|
|
495
|
+
`| ${task} | ${load} | ${skip} |`
|
|
496
|
+
).join('\n');
|
|
497
|
+
const toolRows = details.tools.map(([tool, purpose]) =>
|
|
498
|
+
`| ${tool} | ${purpose} |`
|
|
499
|
+
).join('\n');
|
|
500
|
+
|
|
501
|
+
return `# ${toTitle(dept)} — Department Workspace
|
|
502
|
+
|
|
503
|
+
**Goal:** ${details.goal}
|
|
504
|
+
|
|
505
|
+
---
|
|
506
|
+
|
|
507
|
+
## Task → Load
|
|
508
|
+
|
|
509
|
+
| Task | Load These | Skip These |
|
|
510
|
+
|------|-----------|-----------|
|
|
511
|
+
${taskRows}
|
|
512
|
+
|
|
513
|
+
---
|
|
514
|
+
|
|
515
|
+
## Folder Structure
|
|
516
|
+
|
|
517
|
+
- \`brief.md\` — Project briefs and intake
|
|
518
|
+
- \`assets/\` — Research, source materials, raw inputs
|
|
519
|
+
- \`output/\` — Finished deliverables (\`[slug]-v[n].[ext]\`)
|
|
520
|
+
|
|
521
|
+
---
|
|
522
|
+
|
|
523
|
+
## Skills & Tools
|
|
524
|
+
|
|
525
|
+
| Tool | Purpose |
|
|
526
|
+
|------|---------|
|
|
527
|
+
${toolRows}
|
|
528
|
+
|
|
529
|
+
---
|
|
530
|
+
|
|
531
|
+
## What NOT to Do
|
|
532
|
+
|
|
533
|
+
- Don't load other departments' CONTEXT.md files
|
|
534
|
+
- Don't load \`_system/infra/\` unless this task involves deployment
|
|
535
|
+
- Don't load all of \`company/\` — pick only what's listed above
|
|
536
|
+
`;
|
|
537
|
+
}
|
|
538
|
+
|
|
539
|
+
// ─── products/[slug]/CONTEXT.md ───────────────────────────────────────────────
|
|
540
|
+
|
|
541
|
+
export function generateProductContextMd(product, config) {
|
|
542
|
+
return `# ${product.name} — Product Workspace
|
|
543
|
+
|
|
544
|
+
**Description:** ${product.description || '[TBD]'}
|
|
545
|
+
**Status:** [TBD — planning / active / launched]
|
|
546
|
+
|
|
547
|
+
---
|
|
548
|
+
|
|
549
|
+
## External Resources
|
|
550
|
+
|
|
551
|
+
| Resource | Details |
|
|
552
|
+
|----------|---------|
|
|
553
|
+
| Git repo | [URL — add when created] |
|
|
554
|
+
| Supabase project | [ID — add when created] |
|
|
555
|
+
| VPS deployment | [domain — add when deployed] |
|
|
556
|
+
| Tech stack | [TBD — define in specs] |
|
|
557
|
+
|
|
558
|
+
---
|
|
559
|
+
|
|
560
|
+
## Task → Load
|
|
561
|
+
|
|
562
|
+
| Task | Load These | Skip These |
|
|
563
|
+
|------|-----------|-----------|
|
|
564
|
+
| Planning / brief | \`company/products.md\` | Infra docs, \`specs/\` |
|
|
565
|
+
| Technical specs | \`_system/infra/vps.md\` (if VPS deploy) | Company docs |
|
|
566
|
+
| Active development | \`specs/\` (this product) | Company docs |
|
|
567
|
+
| Deployment | \`_system/infra/vps.md\` | All other docs |
|
|
568
|
+
| Writing product copy | \`company/voice-brand.md\`, \`company/products.md\` | \`specs/\` |
|
|
569
|
+
|
|
570
|
+
---
|
|
571
|
+
|
|
572
|
+
## Folder Structure
|
|
573
|
+
|
|
574
|
+
- \`brief.md\` — What to build and why
|
|
575
|
+
- \`specs/\` — Technical specs, DB schema, API design (\`[feature]-spec.md\`)
|
|
576
|
+
- \`assets/\` — Design mockups, reference materials
|
|
577
|
+
- \`output/\` — Build artifacts, deployment notes
|
|
578
|
+
|
|
579
|
+
---
|
|
580
|
+
|
|
581
|
+
## Build Pipeline
|
|
582
|
+
|
|
583
|
+
1. Brief → \`brief.md\`
|
|
584
|
+
2. Specs → \`specs/[feature]-spec.md\`
|
|
585
|
+
3. Build → Git repo (code lives outside this folder)
|
|
586
|
+
4. Deploy → follow \`_system/infra/vps.md\` pattern
|
|
587
|
+
5. Document → update **External Resources** table above
|
|
588
|
+
`;
|
|
589
|
+
}
|
|
590
|
+
|
|
591
|
+
// ─── _system/CONTEXT.md ───────────────────────────────────────────────────────
|
|
592
|
+
|
|
593
|
+
export function generateSystemContextMd(config) {
|
|
594
|
+
const infraFiles = [];
|
|
595
|
+
if (config.infra.hasVps) infraFiles.push('| Deploy or update a VPS app | `infra/vps.md` | All other docs |');
|
|
596
|
+
if (config.infra.hasLocalServer) {
|
|
597
|
+
const fname = config.infra.localServerName?.toLowerCase().replace(/\s+/g, '-') || 'local-server';
|
|
598
|
+
infraFiles.push(`| ${config.infra.localServerName} tasks | \`infra/${fname}.md\` | All other docs |`);
|
|
599
|
+
}
|
|
600
|
+
if (!infraFiles.length) infraFiles.push('| Infrastructure tasks | Relevant `infra/` file | All other docs |');
|
|
601
|
+
|
|
602
|
+
return `# System — Infrastructure & Templates
|
|
603
|
+
|
|
604
|
+
## When to Load
|
|
605
|
+
|
|
606
|
+
| Task | Load These | Skip |
|
|
607
|
+
|------|-----------|------|
|
|
608
|
+
${infraFiles.join('\n')}
|
|
609
|
+
| Use a project template | \`templates/[type]/CONTEXT.md\` | All other docs |
|
|
610
|
+
|
|
611
|
+
---
|
|
612
|
+
|
|
613
|
+
## Folder Contents
|
|
614
|
+
|
|
615
|
+
- \`infra/\` — Infrastructure reference docs (VPS, local servers)
|
|
616
|
+
- \`templates/\` — Project type templates (biz-initiative, va-workflow, product-build)
|
|
617
|
+
|
|
618
|
+
---
|
|
619
|
+
|
|
620
|
+
## What NOT to Do
|
|
621
|
+
|
|
622
|
+
- Don't load \`_system/\` for anything except infrastructure or template work
|
|
623
|
+
- Don't load company or department docs from here
|
|
624
|
+
`;
|
|
625
|
+
}
|
|
626
|
+
|
|
627
|
+
// ─── _system/infra/vps.md ────────────────────────────────────────────────────
|
|
628
|
+
|
|
629
|
+
export function generateVpsMd(config) {
|
|
630
|
+
const { infra } = config;
|
|
631
|
+
return `# VPS — Infrastructure Reference
|
|
632
|
+
|
|
633
|
+
**Host**: \`${infra.vpsHost || 'TBD'}\`
|
|
634
|
+
**SSH alias**: \`${infra.vpsSshAlias || 'TBD'}\` (config: \`~/.ssh/config\`)
|
|
635
|
+
|
|
636
|
+
---
|
|
637
|
+
|
|
638
|
+
## Deployed Applications
|
|
639
|
+
|
|
640
|
+
| App | Domain | Internal Port | Stack | Directory |
|
|
641
|
+
|-----|--------|--------------|-------|-----------|
|
|
642
|
+
| (none yet — add as apps are deployed) | | | | |
|
|
643
|
+
|
|
644
|
+
---
|
|
645
|
+
|
|
646
|
+
## Deployment Pattern (All New Apps Follow This)
|
|
647
|
+
|
|
648
|
+
\`\`\`bash
|
|
649
|
+
# 1. Create app directory
|
|
650
|
+
mkdir ~/docker/[app-name] && cd ~/docker/[app-name]
|
|
651
|
+
|
|
652
|
+
# 2. Add: docker-compose.yml, Dockerfile, .env
|
|
653
|
+
|
|
654
|
+
# 3. Start containers
|
|
655
|
+
docker compose up -d
|
|
656
|
+
|
|
657
|
+
# 4. Add Nginx config
|
|
658
|
+
sudo nano /etc/nginx/sites-enabled/[subdomain.yourdomain.com]
|
|
659
|
+
sudo nginx -t && sudo systemctl reload nginx
|
|
660
|
+
|
|
661
|
+
# 5. SSL certificate
|
|
662
|
+
sudo certbot --nginx -d [subdomain.yourdomain.com]
|
|
663
|
+
\`\`\`
|
|
664
|
+
|
|
665
|
+
---
|
|
666
|
+
|
|
667
|
+
## Nginx Config Template
|
|
668
|
+
|
|
669
|
+
\`\`\`nginx
|
|
670
|
+
server {
|
|
671
|
+
listen 80;
|
|
672
|
+
server_name [subdomain.yourdomain.com];
|
|
673
|
+
return 301 https://\$server_name\$request_uri;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
server {
|
|
677
|
+
listen 443 ssl http2;
|
|
678
|
+
server_name [subdomain.yourdomain.com];
|
|
679
|
+
|
|
680
|
+
ssl_certificate /etc/letsencrypt/live/[subdomain.yourdomain.com]/fullchain.pem;
|
|
681
|
+
ssl_certificate_key /etc/letsencrypt/live/[subdomain.yourdomain.com]/privkey.pem;
|
|
682
|
+
|
|
683
|
+
location / {
|
|
684
|
+
proxy_pass http://127.0.0.1:[PORT];
|
|
685
|
+
proxy_http_version 1.1;
|
|
686
|
+
proxy_set_header Upgrade \$http_upgrade;
|
|
687
|
+
proxy_set_header Connection 'upgrade';
|
|
688
|
+
proxy_set_header Host \$host;
|
|
689
|
+
proxy_cache_bypass \$http_upgrade;
|
|
690
|
+
}
|
|
691
|
+
}
|
|
692
|
+
\`\`\`
|
|
693
|
+
|
|
694
|
+
---
|
|
695
|
+
|
|
696
|
+
## Running Services
|
|
697
|
+
|
|
698
|
+
nginx, docker, containerd, cron, ssh — all managed by systemd.
|
|
699
|
+
|
|
700
|
+
---
|
|
701
|
+
|
|
702
|
+
## Known Issues
|
|
703
|
+
|
|
704
|
+
- (none yet — document as discovered)
|
|
705
|
+
`;
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// ─── _system/infra/local-server.md ────────────────────────────────────────────
|
|
709
|
+
|
|
710
|
+
export function generateLocalServerMd(config) {
|
|
711
|
+
const name = config.infra.localServerName || 'Local Server';
|
|
712
|
+
const slug = name.toLowerCase().replace(/\s+/g, '-');
|
|
713
|
+
return `# ${name} — Infrastructure Reference
|
|
714
|
+
|
|
715
|
+
**Role**: Always-on local machine for automation and development.
|
|
716
|
+
**Status**: Powered on continuously.
|
|
717
|
+
|
|
718
|
+
---
|
|
719
|
+
|
|
720
|
+
## Capabilities
|
|
721
|
+
|
|
722
|
+
- [TBD — document what this machine does]
|
|
723
|
+
|
|
724
|
+
---
|
|
725
|
+
|
|
726
|
+
## Automation Use Cases
|
|
727
|
+
|
|
728
|
+
| Use Case | Trigger | Notes |
|
|
729
|
+
|----------|---------|-------|
|
|
730
|
+
| [TBD] | [TBD] | |
|
|
731
|
+
|
|
732
|
+
---
|
|
733
|
+
|
|
734
|
+
## Development
|
|
735
|
+
|
|
736
|
+
Can serve as a development environment for work that doesn't need public hosting.
|
|
737
|
+
`;
|
|
738
|
+
}
|
|
739
|
+
|
|
740
|
+
// ─── _system/templates/biz-initiative/CONTEXT.md ────────────────────────────
|
|
741
|
+
|
|
742
|
+
export function generateBizInitiativeTemplateMd() {
|
|
743
|
+
return `# [PROJECT-NAME] — Business Initiative
|
|
744
|
+
|
|
745
|
+
**Type:** biz-initiative
|
|
746
|
+
**Department:** [DEPARTMENT]
|
|
747
|
+
**Created:** [YYYY-MM-DD]
|
|
748
|
+
**Status:** active
|
|
749
|
+
**Goal:** [1-sentence goal from project description]
|
|
750
|
+
|
|
751
|
+
---
|
|
752
|
+
|
|
753
|
+
## What This Project Is
|
|
754
|
+
|
|
755
|
+
[Full description from project creation prompt]
|
|
756
|
+
|
|
757
|
+
---
|
|
758
|
+
|
|
759
|
+
## Task → Load
|
|
760
|
+
|
|
761
|
+
| Task | Load These | Skip These |
|
|
762
|
+
|------|-----------|-----------|
|
|
763
|
+
| Research / planning | None — use Web Search | Company docs unless writing copy |
|
|
764
|
+
| Writing deliverables | \`company/voice-brand.md\` | All other docs |
|
|
765
|
+
| Campaign assets | \`company/voice-brand.md\` | All other docs |
|
|
766
|
+
| Final review | \`company/voice-brand.md\` | All other docs |
|
|
767
|
+
|
|
768
|
+
---
|
|
769
|
+
|
|
770
|
+
## Folder Structure
|
|
771
|
+
|
|
772
|
+
- \`brief.md\` — Project brief, goals, and success criteria
|
|
773
|
+
- \`assets/\` — Research, source materials, raw inputs
|
|
774
|
+
- \`output/\` — Finished deliverables (naming: \`[slug]-v[n].[ext]\`)
|
|
775
|
+
|
|
776
|
+
---
|
|
777
|
+
|
|
778
|
+
## Process
|
|
779
|
+
|
|
780
|
+
1. Define goals → \`brief.md\`
|
|
781
|
+
2. Research → \`assets/\`
|
|
782
|
+
3. Create deliverables → working files or directly to \`output/\`
|
|
783
|
+
4. Review against brief goals
|
|
784
|
+
5. Finalize → \`output/[slug]-v[n].[ext]\`
|
|
785
|
+
6. Mark complete → update **Status** above + \`PROJECT-REGISTRY.md\`
|
|
786
|
+
|
|
787
|
+
---
|
|
788
|
+
|
|
789
|
+
## Skills & Tools
|
|
790
|
+
|
|
791
|
+
| Tool | When | Purpose |
|
|
792
|
+
|------|------|---------|
|
|
793
|
+
| Web Search MCP | Research phase | Trend data, event finding, competitor intel |
|
|
794
|
+
| \`/docx\` | Written deliverables | Formatted Word docs for external use |
|
|
795
|
+
| \`/pptx\` | Presentation deliverables | Slide decks |
|
|
796
|
+
`;
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
// ─── _system/templates/va-workflow/CONTEXT.md ────────────────────────────────
|
|
800
|
+
|
|
801
|
+
export function generateVaWorkflowTemplateMd() {
|
|
802
|
+
return `# [PROJECT-NAME] — VA Workflow
|
|
803
|
+
|
|
804
|
+
**Type:** va-workflow
|
|
805
|
+
**Client:** [CLIENT-NAME]
|
|
806
|
+
**Created:** [YYYY-MM-DD]
|
|
807
|
+
**Status:** active
|
|
808
|
+
**Goal:** [1-sentence goal]
|
|
809
|
+
|
|
810
|
+
---
|
|
811
|
+
|
|
812
|
+
## What This Project Is
|
|
813
|
+
|
|
814
|
+
[Full description from project creation prompt]
|
|
815
|
+
|
|
816
|
+
---
|
|
817
|
+
|
|
818
|
+
## Task → Load
|
|
819
|
+
|
|
820
|
+
| Task | Load These | Skip These |
|
|
821
|
+
|------|-----------|-----------|
|
|
822
|
+
| Design workflow | \`company/sops/\` (1-2 relevant SOPs for style reference) | All other docs |
|
|
823
|
+
| Write SOP | \`company/sops/\` (1-2 relevant SOPs for style reference) | All other docs |
|
|
824
|
+
| Client deliverable prep | None | All docs |
|
|
825
|
+
| Review / revise | The specific SOP being revised | All other docs |
|
|
826
|
+
|
|
827
|
+
---
|
|
828
|
+
|
|
829
|
+
## Folder Structure
|
|
830
|
+
|
|
831
|
+
- \`brief.md\` — Client brief, scope, and requirements
|
|
832
|
+
- \`assets/\` — Client inputs, existing processes, reference materials
|
|
833
|
+
- \`output/\` — Finished SOPs and workflow docs (naming: \`sop-[process]-v[n].[ext]\`)
|
|
834
|
+
|
|
835
|
+
---
|
|
836
|
+
|
|
837
|
+
## Process
|
|
838
|
+
|
|
839
|
+
1. Capture client requirements → \`brief.md\`
|
|
840
|
+
2. Gather inputs → \`assets/\`
|
|
841
|
+
3. Draft SOP / workflow
|
|
842
|
+
4. Review with client feedback
|
|
843
|
+
5. Finalize → \`output/sop-[process]-v[n].[ext]\`
|
|
844
|
+
6. If SOP is company-internal → copy to \`company/sops/sop-[process].md\`
|
|
845
|
+
7. Mark complete → update **Status** above + \`PROJECT-REGISTRY.md\`
|
|
846
|
+
|
|
847
|
+
---
|
|
848
|
+
|
|
849
|
+
## Skills & Tools
|
|
850
|
+
|
|
851
|
+
| Tool | When | Purpose |
|
|
852
|
+
|------|------|---------|
|
|
853
|
+
| \`/docx\` | All SOPs | Formatted Word docs for client delivery |
|
|
854
|
+
| \`/pdf\` | Final delivery | PDF version if client requests it |
|
|
855
|
+
`;
|
|
856
|
+
}
|
|
857
|
+
|
|
858
|
+
// ─── _system/templates/product-build/CONTEXT.md ──────────────────────────────
|
|
859
|
+
|
|
860
|
+
export function generateProductBuildTemplateMd() {
|
|
861
|
+
return `# [PROJECT-NAME] — Product Build
|
|
862
|
+
|
|
863
|
+
**Type:** product-build
|
|
864
|
+
**Product:** [PRODUCT-NAME]
|
|
865
|
+
**Created:** [YYYY-MM-DD]
|
|
866
|
+
**Status:** planning
|
|
867
|
+
**Goal:** [1-sentence goal]
|
|
868
|
+
|
|
869
|
+
---
|
|
870
|
+
|
|
871
|
+
## What This Project Is
|
|
872
|
+
|
|
873
|
+
[Full description from project creation prompt]
|
|
874
|
+
|
|
875
|
+
---
|
|
876
|
+
|
|
877
|
+
## External Resources
|
|
878
|
+
|
|
879
|
+
| Resource | Details |
|
|
880
|
+
|----------|---------|
|
|
881
|
+
| Git repo | [URL — add when created] |
|
|
882
|
+
| Supabase project | [ID — add when created] |
|
|
883
|
+
| VPS deployment | [domain — add when deployed] |
|
|
884
|
+
| Tech stack | [TBD — define in specs] |
|
|
885
|
+
|
|
886
|
+
---
|
|
887
|
+
|
|
888
|
+
## Task → Load
|
|
889
|
+
|
|
890
|
+
| Task | Load These | Skip These |
|
|
891
|
+
|------|-----------|-----------|
|
|
892
|
+
| Planning / brief | \`company/products.md\` | Infra docs, \`specs/\` |
|
|
893
|
+
| Technical specs | \`_system/infra/vps.md\` (if VPS deploy) | Company docs |
|
|
894
|
+
| Active development | \`specs/\` (this project) | Company docs |
|
|
895
|
+
| Deployment | \`_system/infra/vps.md\` | All other docs |
|
|
896
|
+
| Writing product copy | \`company/voice-brand.md\`, \`company/products.md\` | \`specs/\` |
|
|
897
|
+
|
|
898
|
+
---
|
|
899
|
+
|
|
900
|
+
## Folder Structure
|
|
901
|
+
|
|
902
|
+
- \`brief.md\` — What to build and why
|
|
903
|
+
- \`specs/\` — Technical specs, DB schema, API design (naming: \`[feature]-spec.md\`)
|
|
904
|
+
- \`assets/\` — Design mockups, reference materials
|
|
905
|
+
- \`output/\` — Build artifacts, deployment notes
|
|
906
|
+
|
|
907
|
+
---
|
|
908
|
+
|
|
909
|
+
## Build Pipeline
|
|
910
|
+
|
|
911
|
+
1. Brief → \`brief.md\` (what + why)
|
|
912
|
+
2. Specs → \`specs/[feature]-spec.md\` (tech decisions)
|
|
913
|
+
3. Build → Git repo (code lives outside this folder)
|
|
914
|
+
4. Deploy → follow \`_system/infra/vps.md\` pattern
|
|
915
|
+
5. Document → update **External Resources** table above with live URLs
|
|
916
|
+
6. Mark complete → update **Status** above + \`PROJECT-REGISTRY.md\`
|
|
917
|
+
|
|
918
|
+
---
|
|
919
|
+
|
|
920
|
+
## Skills & Tools
|
|
921
|
+
|
|
922
|
+
| Tool | When | Purpose |
|
|
923
|
+
|------|------|---------|
|
|
924
|
+
| Web Search MCP | Specs phase | Library docs, best practices, API references |
|
|
925
|
+
| \`_system/infra/vps.md\` | Deployment | VPS deployment pattern and commands |
|
|
926
|
+
`;
|
|
927
|
+
}
|