ctx-cc 3.5.0 → 4.1.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 +375 -676
- package/agents/ctx-arch-mapper.md +5 -3
- package/agents/ctx-auditor.md +5 -3
- package/agents/ctx-codex-reviewer.md +214 -0
- package/agents/ctx-concerns-mapper.md +5 -3
- package/agents/ctx-criteria-suggester.md +6 -4
- package/agents/ctx-debugger.md +5 -3
- package/agents/ctx-designer.md +488 -114
- package/agents/ctx-discusser.md +5 -3
- package/agents/ctx-executor.md +5 -3
- package/agents/ctx-handoff.md +6 -4
- package/agents/ctx-learner.md +5 -3
- package/agents/ctx-mapper.md +4 -3
- package/agents/ctx-ml-analyst.md +600 -0
- package/agents/ctx-ml-engineer.md +933 -0
- package/agents/ctx-ml-reviewer.md +485 -0
- package/agents/ctx-ml-scientist.md +626 -0
- package/agents/ctx-parallelizer.md +4 -3
- package/agents/ctx-planner.md +5 -3
- package/agents/ctx-predictor.md +4 -3
- package/agents/ctx-qa.md +5 -3
- package/agents/ctx-quality-mapper.md +5 -3
- package/agents/ctx-researcher.md +5 -3
- package/agents/ctx-reviewer.md +6 -4
- package/agents/ctx-team-coordinator.md +5 -3
- package/agents/ctx-tech-mapper.md +5 -3
- package/agents/ctx-verifier.md +5 -3
- package/bin/ctx.js +199 -27
- package/commands/brand.md +309 -0
- package/commands/ctx.md +10 -10
- package/commands/design.md +304 -0
- package/commands/experiment.md +251 -0
- package/commands/help.md +57 -7
- package/commands/init.md +25 -0
- package/commands/metrics.md +1 -1
- package/commands/milestone.md +1 -1
- package/commands/ml-status.md +197 -0
- package/commands/monitor.md +1 -1
- package/commands/train.md +266 -0
- package/commands/visual-qa.md +559 -0
- package/commands/voice.md +1 -1
- package/hooks/post-tool-use.js +39 -0
- package/hooks/pre-tool-use.js +94 -0
- package/hooks/subagent-stop.js +32 -0
- package/package.json +9 -3
- package/plugin.json +46 -0
- package/skills/ctx-design-system/SKILL.md +572 -0
- package/skills/ctx-ml-experiment/SKILL.md +334 -0
- package/skills/ctx-ml-pipeline/SKILL.md +437 -0
- package/skills/ctx-orchestrator/SKILL.md +91 -0
- package/skills/ctx-review-gate/SKILL.md +147 -0
- package/skills/ctx-state/SKILL.md +100 -0
- package/skills/ctx-visual-qa/SKILL.md +587 -0
- package/src/agents.js +109 -0
- package/src/auto.js +287 -0
- package/src/capabilities.js +226 -0
- package/src/commits.js +94 -0
- package/src/config.js +112 -0
- package/src/context.js +241 -0
- package/src/handoff.js +156 -0
- package/src/hooks.js +218 -0
- package/src/install.js +125 -50
- package/src/lifecycle.js +194 -0
- package/src/metrics.js +198 -0
- package/src/pipeline.js +269 -0
- package/src/review-gate.js +338 -0
- package/src/runner.js +120 -0
- package/src/skills.js +143 -0
- package/src/state.js +267 -0
- package/src/worktree.js +244 -0
- package/templates/PRD.json +1 -1
- package/templates/config.json +4 -237
- package/workflows/ctx-router.md +0 -485
- package/workflows/map-codebase.md +0 -329
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-quality-mapper
|
|
3
|
-
description: Quality mapper for CTX
|
|
3
|
+
description: Quality mapper for CTX 4.0. Analyzes test coverage, lint status, type safety, and code smells. Part of parallel codebase mapping.
|
|
4
4
|
tools: Read, Write, Bash, Glob, Grep
|
|
5
|
-
|
|
5
|
+
model: haiku
|
|
6
|
+
maxTurns: 15
|
|
7
|
+
memory: project
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<role>
|
|
9
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 quality mapper. You analyze:
|
|
10
12
|
- Test coverage and quality
|
|
11
13
|
- Linting and formatting status
|
|
12
14
|
- Type safety and strictness
|
package/agents/ctx-researcher.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-researcher
|
|
3
|
-
description: Research agent for CTX
|
|
3
|
+
description: Research agent for CTX 4.0. Uses ArguSeek for web research and ChunkHound for semantic code search. Reads PRD story for context. Spawned when status = "initializing".
|
|
4
4
|
tools: Read, Write, Bash, Glob, Grep, mcp__arguseek__*, mcp__chunkhound__*
|
|
5
|
-
|
|
5
|
+
model: opus
|
|
6
|
+
maxTurns: 25
|
|
7
|
+
memory: project
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<role>
|
|
9
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 researcher. Your job is to gather information for a PRD story before planning.
|
|
10
12
|
|
|
11
13
|
You use:
|
|
12
14
|
1. **PRD.json** - Story title, description, and acceptance criteria
|
package/agents/ctx-reviewer.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-reviewer
|
|
3
|
-
description: Proactive error prevention agent for CTX
|
|
3
|
+
description: Proactive error prevention agent for CTX 4.0. Reviews code changes BEFORE commit to catch errors early. Runs type checks, import validation, security scans, and best practice enforcement.
|
|
4
4
|
tools: Read, Bash, Glob, Grep
|
|
5
|
-
|
|
5
|
+
model: sonnet
|
|
6
|
+
maxTurns: 25
|
|
7
|
+
memory: project
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<role>
|
|
9
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 reviewer. Your job is to:
|
|
10
12
|
1. Review code changes before they are committed
|
|
11
13
|
2. Catch type errors, import issues, and security vulnerabilities
|
|
12
14
|
3. Enforce best practices and patterns from CONTEXT.md
|
|
@@ -21,7 +23,7 @@ You are the last line of defense before code enters the codebase.
|
|
|
21
23
|
## Proactive vs Reactive
|
|
22
24
|
|
|
23
25
|
**Reactive** (current): Write code → Commit → Fail build → Debug → Fix
|
|
24
|
-
**Proactive** (CTX
|
|
26
|
+
**Proactive** (CTX 4.0): Write code → Review → Fix → Commit (clean)
|
|
25
27
|
|
|
26
28
|
Catching errors before commit:
|
|
27
29
|
- Saves debug cycles
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-team-coordinator
|
|
3
|
-
description: Team collaboration agent for CTX
|
|
3
|
+
description: Team collaboration agent for CTX 4.0. Manages file locks, prevents conflicts, and coordinates notifications across team members.
|
|
4
4
|
tools: Read, Write, Bash, Glob, Grep
|
|
5
|
-
|
|
5
|
+
model: haiku
|
|
6
|
+
maxTurns: 15
|
|
7
|
+
memory: project
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<role>
|
|
9
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 team coordinator. You manage:
|
|
10
12
|
- File locking during execution
|
|
11
13
|
- Conflict detection and resolution
|
|
12
14
|
- Team notifications (Slack/Discord)
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-tech-mapper
|
|
3
|
-
description: Tech stack mapper for CTX
|
|
3
|
+
description: Tech stack mapper for CTX 4.0. Analyzes languages, frameworks, dependencies, and versions. Part of parallel codebase mapping.
|
|
4
4
|
tools: Read, Write, Bash, Glob, Grep
|
|
5
|
-
|
|
5
|
+
model: haiku
|
|
6
|
+
maxTurns: 15
|
|
7
|
+
memory: project
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<role>
|
|
9
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 tech stack mapper. You analyze:
|
|
10
12
|
- Programming languages and their proportions
|
|
11
13
|
- Frameworks and libraries
|
|
12
14
|
- Dependencies and versions
|
package/agents/ctx-verifier.md
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: ctx-verifier
|
|
3
|
-
description: Verification agent for CTX
|
|
3
|
+
description: Verification agent for CTX 4.0. Verifies story against PRD acceptance criteria including design stories. Updates passes flag on success. Spawned when status = "verifying".
|
|
4
4
|
tools: Read, Write, Glob, Grep, Bash, mcp__playwright__*, mcp__chrome-devtools__*, mcp__gemini-design__*
|
|
5
|
-
|
|
5
|
+
model: haiku
|
|
6
|
+
maxTurns: 15
|
|
7
|
+
memory: project
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<role>
|
|
9
|
-
You are a CTX
|
|
11
|
+
You are a CTX 4.0 verifier. Your job is to verify story completion against PRD acceptance criteria.
|
|
10
12
|
|
|
11
13
|
You verify based on story type:
|
|
12
14
|
|
package/bin/ctx.js
CHANGED
|
@@ -1,50 +1,222 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
* CTX 4.0 CLI — Thin installer for Claude Code.
|
|
5
|
+
*
|
|
6
|
+
* This CLI installs agents, skills, commands, and hooks into ~/.claude/.
|
|
7
|
+
* Orchestration happens INSIDE Claude Code via the Agent tool, not here.
|
|
8
|
+
*/
|
|
9
|
+
|
|
3
10
|
import { install } from '../src/install.js';
|
|
11
|
+
import { discoverAgents, formatAgentTable } from '../src/agents.js';
|
|
12
|
+
import { loadConfig, getByPath, setByPath, saveConfig, formatConfigTable } from '../src/config.js';
|
|
13
|
+
import { analyzeDescriptions, formatAnalysis, calculateUpfrontTokens } from '../src/skills.js';
|
|
14
|
+
import { updateProjectManifest, MANIFEST_VERSION } from '../src/capabilities.js';
|
|
15
|
+
import fs from 'fs';
|
|
16
|
+
import path from 'path';
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
4
18
|
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = path.dirname(__filename);
|
|
21
|
+
const PACKAGE_ROOT = path.resolve(__dirname, '..');
|
|
22
|
+
const AGENTS_DIR = path.join(PACKAGE_ROOT, 'agents');
|
|
23
|
+
const CONFIG_PATH = path.join(PACKAGE_ROOT, 'templates', 'config.json');
|
|
24
|
+
|
|
25
|
+
// ANSI helpers
|
|
26
|
+
const cyan = (s) => `\x1b[36m${s}\x1b[0m`;
|
|
27
|
+
const green = (s) => `\x1b[32m${s}\x1b[0m`;
|
|
28
|
+
const red = (s) => `\x1b[31m${s}\x1b[0m`;
|
|
29
|
+
const bold = (s) => `\x1b[1m${s}\x1b[0m`;
|
|
30
|
+
const dim = (s) => `\x1b[2m${s}\x1b[0m`;
|
|
12
31
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
32
|
+
const VERSION = JSON.parse(
|
|
33
|
+
fs.readFileSync(path.join(PACKAGE_ROOT, 'package.json'), 'utf-8')
|
|
34
|
+
).version;
|
|
35
|
+
|
|
36
|
+
function printBanner() {
|
|
37
|
+
console.log(cyan(`
|
|
38
|
+
██████╗████████╗██╗ ██╗
|
|
16
39
|
██╔════╝╚══██╔══╝╚██╗██╔╝
|
|
17
40
|
██║ ██║ ╚███╔╝
|
|
18
41
|
██║ ██║ ██╔██╗
|
|
19
42
|
╚██████╗ ██║ ██╔╝ ██╗
|
|
20
|
-
╚═════╝ ╚═╝ ╚═╝
|
|
43
|
+
╚═════╝ ╚═╝ ╚═╝ ╚═╝`));
|
|
44
|
+
console.log(`\n ${bold('CTX 4.0')} ${dim(`v${VERSION}`)}`);
|
|
45
|
+
console.log(' Intelligent workflow orchestration for Claude Code.\n');
|
|
46
|
+
}
|
|
21
47
|
|
|
22
|
-
|
|
23
|
-
Intelligent workflow orchestration for Claude Code.
|
|
24
|
-
20 agents. Learning system. Predictive planning. Self-healing.
|
|
48
|
+
// --- Subcommands ---
|
|
25
49
|
|
|
26
|
-
|
|
27
|
-
|
|
50
|
+
function showHelp() {
|
|
51
|
+
printBanner();
|
|
52
|
+
console.log(` ${bold('Usage:')}
|
|
53
|
+
npx ctx-cc [options] Install CTX into Claude Code
|
|
54
|
+
npx ctx-cc list List available agents
|
|
55
|
+
npx ctx-cc skills Analyze agent skill descriptions
|
|
56
|
+
npx ctx-cc config list Show configuration
|
|
57
|
+
npx ctx-cc config get <key> Get config value
|
|
58
|
+
npx ctx-cc config set <k> <v> Set config value
|
|
59
|
+
npx ctx-cc update-manifest Migrate project capability manifest
|
|
28
60
|
|
|
29
|
-
|
|
61
|
+
${bold('Install Options:')}
|
|
30
62
|
--global, -g Install to ~/.claude (default)
|
|
31
63
|
--project, -p Install to .claude in current directory
|
|
32
64
|
--force, -f Overwrite existing installation
|
|
33
65
|
--help, -h Show this help message
|
|
34
66
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
67
|
+
${bold('After Installation:')}
|
|
68
|
+
Launch Claude Code and use:
|
|
69
|
+
/ctx Smart router — describe what you want
|
|
70
|
+
/ctx:help Full command reference
|
|
71
|
+
/ctx:init Initialize a project
|
|
72
|
+
/ctx:plan Plan a story
|
|
73
|
+
/ctx:status Check progress
|
|
38
74
|
|
|
39
|
-
|
|
40
|
-
|
|
75
|
+
${bold('Architecture:')}
|
|
76
|
+
CTX installs into Claude Code's native extension points:
|
|
77
|
+
~/.claude/agents/ 26 subagents (invoked via Agent tool)
|
|
78
|
+
~/.claude/skills/ 7 skills (auto-discovered by Claude)
|
|
79
|
+
~/.claude/commands/ Slash commands (/ctx:*)
|
|
80
|
+
~/.claude/hooks/ Deterministic enforcement scripts
|
|
41
81
|
`);
|
|
42
|
-
process.exit(0);
|
|
43
82
|
}
|
|
44
83
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
84
|
+
function listAgents() {
|
|
85
|
+
const agents = discoverAgents(AGENTS_DIR);
|
|
86
|
+
if (agents.length === 0) {
|
|
87
|
+
console.log(red(' No agents found in agents/ directory.'));
|
|
88
|
+
process.exit(1);
|
|
89
|
+
}
|
|
90
|
+
printBanner();
|
|
91
|
+
console.log(` ${bold(`${agents.length} Agents Available`)}\n`);
|
|
92
|
+
console.log(formatAgentTable(agents));
|
|
93
|
+
console.log(`\n ${dim('Agents are invoked by Claude Code via the Agent tool.')}`);
|
|
94
|
+
console.log(` ${dim('Use /ctx in Claude Code to interact with agents.')}\n`);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
function handleConfig(subArgs) {
|
|
98
|
+
const [action, key, ...rest] = subArgs;
|
|
99
|
+
const config = loadConfig(CONFIG_PATH);
|
|
100
|
+
|
|
101
|
+
if (!action || action === 'list') {
|
|
102
|
+
printBanner();
|
|
103
|
+
console.log(` ${bold('Configuration')}\n`);
|
|
104
|
+
console.log(formatConfigTable(config));
|
|
105
|
+
console.log();
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
if (action === 'get') {
|
|
110
|
+
if (!key) {
|
|
111
|
+
console.error(red(' Error: config get requires a key. Run "ctx-cc config list" to see valid keys.'));
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
const val = getByPath(config, key);
|
|
115
|
+
if (val === undefined) {
|
|
116
|
+
console.error(red(` Error: unknown key "${key}". Run "ctx-cc config list" to see valid keys.`));
|
|
117
|
+
process.exit(1);
|
|
118
|
+
}
|
|
119
|
+
console.log(JSON.stringify(val, null, 2));
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
if (action === 'set') {
|
|
124
|
+
if (!key || rest.length === 0) {
|
|
125
|
+
console.error(red(' Error: usage: ctx-cc config set <key> <value>'));
|
|
126
|
+
process.exit(1);
|
|
127
|
+
}
|
|
128
|
+
const value = rest.join(' ');
|
|
129
|
+
if (getByPath(config, key) === undefined) {
|
|
130
|
+
console.error(red(` Error: unknown key "${key}". Run "ctx-cc config list" to see valid keys.`));
|
|
131
|
+
process.exit(1);
|
|
132
|
+
}
|
|
133
|
+
setByPath(config, key, value);
|
|
134
|
+
saveConfig(CONFIG_PATH, config);
|
|
135
|
+
console.log(green(` ✓ Set ${key} = ${JSON.stringify(getByPath(config, key))}`));
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
console.error(red(` Error: unknown config action "${action}". Use list, get, or set.`));
|
|
140
|
+
process.exit(1);
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
function handleUpdateManifest() {
|
|
144
|
+
const ctxDir = path.join(process.cwd(), '.ctx');
|
|
145
|
+
if (!fs.existsSync(ctxDir)) {
|
|
146
|
+
console.error(red(` Error: no .ctx/ directory in ${process.cwd()}.`));
|
|
147
|
+
console.error(` Run ${cyan('/ctx:init')} in Claude Code to initialize a project first.`);
|
|
148
|
+
process.exit(1);
|
|
149
|
+
}
|
|
150
|
+
printBanner();
|
|
151
|
+
const result = updateProjectManifest(ctxDir);
|
|
152
|
+
switch (result.action) {
|
|
153
|
+
case 'created':
|
|
154
|
+
console.log(green(' ✓') + ` Seeded capability-manifest.json at v${result.to}`);
|
|
155
|
+
console.log(` ${dim('Path:')} ${result.path}`);
|
|
156
|
+
break;
|
|
157
|
+
case 'current':
|
|
158
|
+
console.log(green(' ✓') + ` Manifest already at v${result.to} — no change`);
|
|
159
|
+
break;
|
|
160
|
+
case 'migrated':
|
|
161
|
+
console.log(green(' ✓') + ` Migrated manifest v${result.from} → v${result.to}`);
|
|
162
|
+
console.log(` ${dim('Backup:')} ${result.backup}`);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
console.log();
|
|
48
166
|
}
|
|
49
167
|
|
|
50
|
-
|
|
168
|
+
function handleSkills() {
|
|
169
|
+
const analysis = analyzeDescriptions(AGENTS_DIR);
|
|
170
|
+
const { totalTokens, agentCount } = calculateUpfrontTokens(AGENTS_DIR);
|
|
171
|
+
printBanner();
|
|
172
|
+
console.log(` ${bold('Skills Analysis')}\n`);
|
|
173
|
+
console.log(formatAnalysis(analysis));
|
|
174
|
+
console.log(`\n ${dim('Target: <2500 tokens total for all descriptions (progressive disclosure).')}`);
|
|
175
|
+
console.log(` ${dim('Current: ~${totalTokens} tokens for ${agentCount} agents.')}\n`);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// --- Main ---
|
|
179
|
+
|
|
180
|
+
const args = process.argv.slice(2);
|
|
181
|
+
const command = args[0];
|
|
182
|
+
|
|
183
|
+
const flags = {
|
|
184
|
+
global: args.includes('--global') || args.includes('-g'),
|
|
185
|
+
project: args.includes('--project') || args.includes('-p'),
|
|
186
|
+
force: args.includes('--force') || args.includes('-f'),
|
|
187
|
+
help: args.includes('--help') || args.includes('-h'),
|
|
188
|
+
};
|
|
189
|
+
|
|
190
|
+
if (flags.help && !command) {
|
|
191
|
+
showHelp();
|
|
192
|
+
process.exit(0);
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
switch (command) {
|
|
196
|
+
case 'list':
|
|
197
|
+
listAgents();
|
|
198
|
+
break;
|
|
199
|
+
|
|
200
|
+
case 'config':
|
|
201
|
+
handleConfig(args.slice(1));
|
|
202
|
+
break;
|
|
203
|
+
|
|
204
|
+
case 'skills':
|
|
205
|
+
handleSkills();
|
|
206
|
+
break;
|
|
207
|
+
|
|
208
|
+
case 'update-manifest':
|
|
209
|
+
handleUpdateManifest();
|
|
210
|
+
break;
|
|
211
|
+
|
|
212
|
+
case '--help':
|
|
213
|
+
case '-h':
|
|
214
|
+
showHelp();
|
|
215
|
+
break;
|
|
216
|
+
|
|
217
|
+
default:
|
|
218
|
+
// Default: install (backward compatible)
|
|
219
|
+
if (!flags.global && !flags.project) flags.global = true;
|
|
220
|
+
install(flags);
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: ctx:brand
|
|
3
|
+
description: Establish visual foundation — front-loaded discovery, competitive research, mood board, 3 brand directions, BRAND_KIT.md, W3C DTCG tokens. Mandatory approval gates at every phase.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
<objective>
|
|
7
|
+
Build the visual foundation for a project from scratch. Produces BRAND_KIT.md, a three-tier W3C token system, and exported style assets. Every approval gate is mandatory — no phase is skipped.
|
|
8
|
+
</objective>
|
|
9
|
+
|
|
10
|
+
<usage>
|
|
11
|
+
```bash
|
|
12
|
+
/ctx:brand # Full brand establishment workflow
|
|
13
|
+
/ctx:brand --update # Update existing brand (adds to BRAND_KIT.md, extends tokens)
|
|
14
|
+
/ctx:brand --tokens-only # Regenerate token files from existing BRAND_KIT.md
|
|
15
|
+
/ctx:brand --export # Re-export brand-assets/ from current tokens
|
|
16
|
+
```
|
|
17
|
+
</usage>
|
|
18
|
+
|
|
19
|
+
<process>
|
|
20
|
+
|
|
21
|
+
## Step 1: Check Existing Brand State
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
# Check if BRAND_KIT.md already exists
|
|
25
|
+
ls BRAND_KIT.md 2>/dev/null && echo "EXISTS" || echo "MISSING"
|
|
26
|
+
ls tokens/ 2>/dev/null && ls tokens/*.tokens.json 2>/dev/null || echo "NO_TOKENS"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
**If BRAND_KIT.md exists and not `--update` flag:**
|
|
30
|
+
|
|
31
|
+
```
|
|
32
|
+
BRAND_KIT.md already exists in this project.
|
|
33
|
+
|
|
34
|
+
Current version: [read from BRAND_KIT.md header]
|
|
35
|
+
|
|
36
|
+
Options:
|
|
37
|
+
A Update brand — extend colors, typography, or tokens
|
|
38
|
+
B Rebuild brand — start fresh (will overwrite BRAND_KIT.md)
|
|
39
|
+
C Export only — regenerate brand-assets/ from current tokens
|
|
40
|
+
D Cancel
|
|
41
|
+
|
|
42
|
+
Proceed with: ?
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
## Step 2: Load Project Context
|
|
46
|
+
|
|
47
|
+
Read PRD for product understanding:
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
python3 -c "
|
|
51
|
+
import json, sys
|
|
52
|
+
try:
|
|
53
|
+
with open('.ctx/PRD.json') as f:
|
|
54
|
+
prd = json.load(f)
|
|
55
|
+
print('PROJECT:', prd.get('project', {}).get('name', 'Unknown'))
|
|
56
|
+
print('DESCRIPTION:', prd.get('project', {}).get('description', ''))
|
|
57
|
+
print('TARGET_USER:', prd.get('context', {}).get('targetUser', ''))
|
|
58
|
+
print('PROBLEM:', prd.get('context', {}).get('problem', ''))
|
|
59
|
+
except:
|
|
60
|
+
print('NO_PRD')
|
|
61
|
+
"
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Step 3: Front-Loaded Discovery
|
|
65
|
+
|
|
66
|
+
**Ask ALL questions upfront in one block.** Do not ask one at a time.
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
Before I begin visual research, I need to understand your brand direction.
|
|
70
|
+
Answer all questions — you can be brief. I'll handle the details.
|
|
71
|
+
|
|
72
|
+
1. FEELING
|
|
73
|
+
What 3-5 adjectives should describe this product's visual feel?
|
|
74
|
+
(e.g., "bold, modern, trustworthy" or "warm, approachable, friendly")
|
|
75
|
+
|
|
76
|
+
2. INSPIRATION
|
|
77
|
+
Name 2-3 products, brands, or websites whose visual design you admire.
|
|
78
|
+
(e.g., "Linear, Stripe, Apple" — doesn't have to be in your industry)
|
|
79
|
+
|
|
80
|
+
3. AVOID
|
|
81
|
+
Any visual styles you strongly want to avoid?
|
|
82
|
+
(e.g., "no gradients", "nothing corporate/boring", "no dark backgrounds")
|
|
83
|
+
|
|
84
|
+
4. EXISTING ASSETS
|
|
85
|
+
Do you have any existing brand assets?
|
|
86
|
+
- Logo file? (yes/no — share path if yes)
|
|
87
|
+
- Existing colors? (share hex codes if yes)
|
|
88
|
+
- Existing fonts? (share names if yes)
|
|
89
|
+
- Figma file? (share file key if yes)
|
|
90
|
+
|
|
91
|
+
5. MODES
|
|
92
|
+
Light mode only / Dark mode only / Both?
|
|
93
|
+
|
|
94
|
+
6. MARKET
|
|
95
|
+
EU market? (affects EAA 2025 accessibility compliance requirements)
|
|
96
|
+
|
|
97
|
+
7. AUDIENCE
|
|
98
|
+
Who is the primary user? (tech-savvy pros / general consumers / enterprise / other)
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Save answers to `.ctx/phases/brand/DISCOVERY.md`:
|
|
102
|
+
|
|
103
|
+
```markdown
|
|
104
|
+
# Brand Discovery
|
|
105
|
+
|
|
106
|
+
**Date:** [ISO-8601]
|
|
107
|
+
**Project:** [name from PRD or user]
|
|
108
|
+
|
|
109
|
+
## Answers
|
|
110
|
+
|
|
111
|
+
### Desired Feeling
|
|
112
|
+
[adjectives]
|
|
113
|
+
|
|
114
|
+
### Visual Inspiration
|
|
115
|
+
[list]
|
|
116
|
+
|
|
117
|
+
### Styles to Avoid
|
|
118
|
+
[list]
|
|
119
|
+
|
|
120
|
+
### Existing Assets
|
|
121
|
+
- Logo: [yes/no, path]
|
|
122
|
+
- Colors: [values or none]
|
|
123
|
+
- Fonts: [names or none]
|
|
124
|
+
- Figma: [file key or none]
|
|
125
|
+
|
|
126
|
+
### Mode Support
|
|
127
|
+
[light/dark/both]
|
|
128
|
+
|
|
129
|
+
### Market
|
|
130
|
+
[EU: yes/no]
|
|
131
|
+
|
|
132
|
+
### Audience
|
|
133
|
+
[description]
|
|
134
|
+
```
|
|
135
|
+
|
|
136
|
+
## Step 4: Spawn ctx-designer — Brand Workflow
|
|
137
|
+
|
|
138
|
+
With all discovery answers in hand, spawn the designer for the full brand workflow:
|
|
139
|
+
|
|
140
|
+
```
|
|
141
|
+
Agent({
|
|
142
|
+
subagent_type: "ctx-designer",
|
|
143
|
+
prompt: "
|
|
144
|
+
Execute the full brand establishment workflow.
|
|
145
|
+
|
|
146
|
+
Story type: brand
|
|
147
|
+
Story ID: brand-001
|
|
148
|
+
Phase storage: .ctx/phases/brand/
|
|
149
|
+
|
|
150
|
+
Project context:
|
|
151
|
+
[paste PRD summary: name, description, target user, problem]
|
|
152
|
+
|
|
153
|
+
Discovery answers:
|
|
154
|
+
[paste full DISCOVERY.md content]
|
|
155
|
+
|
|
156
|
+
Brand workflow phases (execute in order):
|
|
157
|
+
1. Phase 2: Competitive Visual Research
|
|
158
|
+
- ArguSeek: research '[product type] visual design trends 2025'
|
|
159
|
+
- Browse 10-15 references (Dribbble, Behance, Awwwards, Mobbin)
|
|
160
|
+
- Save screenshots to .ctx/phases/brand/refs/
|
|
161
|
+
|
|
162
|
+
2. Phase 3: Mood Board
|
|
163
|
+
- Create .ctx/phases/brand/MOOD_BOARD.md
|
|
164
|
+
- Include: visual direction summary, reference gallery, color themes, typography directions, patterns to adopt, patterns to avoid
|
|
165
|
+
- STOP — wait for approval before continuing
|
|
166
|
+
|
|
167
|
+
3. Phase 4: Generate 3 Brand Directions
|
|
168
|
+
After mood board approval:
|
|
169
|
+
- Option A: Conservative — safe, traditional, low risk
|
|
170
|
+
- Option B: Balanced — modern, accessible, recommended
|
|
171
|
+
- Option C: Bold — distinctive, higher risk/reward
|
|
172
|
+
- Generate visual for each using Gemini
|
|
173
|
+
- Save to .ctx/phases/brand/option-a.png, option-b.png, option-c.png
|
|
174
|
+
- Present side-by-side comparison with: colors (hex), fonts, feel adjectives
|
|
175
|
+
- STOP — wait for direction selection
|
|
176
|
+
|
|
177
|
+
5. Phase 5: Build Token System
|
|
178
|
+
After direction selection:
|
|
179
|
+
- Create tokens/primitive.tokens.json (W3C DTCG, oklch color space)
|
|
180
|
+
- Create tokens/semantic.tokens.json (mode-aware light/dark)
|
|
181
|
+
- Create tokens/component.tokens.json (button, input, card at minimum)
|
|
182
|
+
- Create tokens/themes/light.tokens.json
|
|
183
|
+
- Create tokens/themes/dark.tokens.json (if dark mode requested)
|
|
184
|
+
- All tokens must pass contrast audit before proceeding:
|
|
185
|
+
* Text pairs: 4.5:1 minimum
|
|
186
|
+
* UI component pairs: 3:1 minimum
|
|
187
|
+
|
|
188
|
+
6. Phase 6: Create BRAND_KIT.md
|
|
189
|
+
- Write comprehensive brand kit to project root
|
|
190
|
+
- Include: brand essence, token architecture, full color system with accessibility table, typography stack, spacing system, motion tokens, do's and don'ts
|
|
191
|
+
|
|
192
|
+
7. Phase 7: Generate Exports
|
|
193
|
+
- brand-assets/tokens.css (CSS custom properties)
|
|
194
|
+
- brand-assets/tokens.scss (SCSS variables)
|
|
195
|
+
- brand-assets/tokens.js (JS constants)
|
|
196
|
+
- brand-assets/tailwind.config.js (Tailwind theme extension)
|
|
197
|
+
|
|
198
|
+
Approval gates:
|
|
199
|
+
- Gate 1: Mood board approval (Phase 3) — MANDATORY STOP
|
|
200
|
+
- Gate 2: Direction selection (Phase 4) — MANDATORY STOP
|
|
201
|
+
- Gate 3: Token contrast audit (Phase 5) — auto, fix if fail
|
|
202
|
+
- Gate 4: Final BRAND_KIT.md review — MANDATORY STOP
|
|
203
|
+
|
|
204
|
+
Do NOT proceed past a gate without explicit approval.
|
|
205
|
+
",
|
|
206
|
+
description: "Establish brand: [project name]"
|
|
207
|
+
})
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
## Step 5: Track Approval Gates in STATE.json
|
|
211
|
+
|
|
212
|
+
After each gate is passed, record it:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
python3 -c "
|
|
216
|
+
import json, sys
|
|
217
|
+
from datetime import datetime
|
|
218
|
+
|
|
219
|
+
with open('.ctx/STATE.json', 'r') as f:
|
|
220
|
+
state = json.load(f)
|
|
221
|
+
|
|
222
|
+
state.setdefault('brand', {})
|
|
223
|
+
state['brand']['discoveryComplete'] = True
|
|
224
|
+
state['brand']['discoveryAt'] = datetime.utcnow().isoformat() + 'Z'
|
|
225
|
+
state['brand']['approvalGates'] = {
|
|
226
|
+
'moodBoard': { 'approved': False, 'approvedAt': None },
|
|
227
|
+
'direction': { 'approved': False, 'selectedOption': None, 'approvedAt': None },
|
|
228
|
+
'brandKit': { 'approved': False, 'approvedAt': None }
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
with open('.ctx/STATE.json', 'w') as f:
|
|
232
|
+
json.dump(state, f, indent=2)
|
|
233
|
+
|
|
234
|
+
print('STATE.json updated')
|
|
235
|
+
"
|
|
236
|
+
```
|
|
237
|
+
|
|
238
|
+
When each gate is passed, update the corresponding entry:
|
|
239
|
+
|
|
240
|
+
```bash
|
|
241
|
+
# Example: mark mood board approved
|
|
242
|
+
python3 -c "
|
|
243
|
+
import json
|
|
244
|
+
from datetime import datetime
|
|
245
|
+
|
|
246
|
+
with open('.ctx/STATE.json', 'r') as f:
|
|
247
|
+
state = json.load(f)
|
|
248
|
+
|
|
249
|
+
state['brand']['approvalGates']['moodBoard']['approved'] = True
|
|
250
|
+
state['brand']['approvalGates']['moodBoard']['approvedAt'] = datetime.utcnow().isoformat() + 'Z'
|
|
251
|
+
|
|
252
|
+
with open('.ctx/STATE.json', 'w') as f:
|
|
253
|
+
json.dump(state, f, indent=2)
|
|
254
|
+
"
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
## Step 6: Post-Brand Summary
|
|
258
|
+
|
|
259
|
+
After all gates pass and exports are generated:
|
|
260
|
+
|
|
261
|
+
```
|
|
262
|
+
[CTX BRAND] Complete
|
|
263
|
+
|
|
264
|
+
Files created:
|
|
265
|
+
BRAND_KIT.md Visual brand reference
|
|
266
|
+
tokens/primitive.tokens.json Raw value scale
|
|
267
|
+
tokens/semantic.tokens.json Purpose aliases (light/dark)
|
|
268
|
+
tokens/component.tokens.json Component tokens
|
|
269
|
+
tokens/themes/dark.tokens.json Dark mode overrides (if applicable)
|
|
270
|
+
brand-assets/tokens.css CSS custom properties
|
|
271
|
+
brand-assets/tokens.scss SCSS variables
|
|
272
|
+
brand-assets/tokens.js JS constants
|
|
273
|
+
brand-assets/tailwind.config.js Tailwind theme
|
|
274
|
+
|
|
275
|
+
Approval gates passed:
|
|
276
|
+
[x] Mood board approved
|
|
277
|
+
[x] Direction selected: Option [A/B/C]
|
|
278
|
+
[x] BRAND_KIT.md approved
|
|
279
|
+
|
|
280
|
+
Accessibility:
|
|
281
|
+
Contrast audit: PASS
|
|
282
|
+
Touch target tokens: 44px minimum defined
|
|
283
|
+
EAA 2025: [compliant / not applicable]
|
|
284
|
+
|
|
285
|
+
Next steps:
|
|
286
|
+
/ctx:design — Start designing components using the brand
|
|
287
|
+
/ctx:qa — Run full quality assurance
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
</process>
|
|
291
|
+
|
|
292
|
+
<output>
|
|
293
|
+
```
|
|
294
|
+
[CTX BRAND] Brand Establishment
|
|
295
|
+
|
|
296
|
+
Project: [name]
|
|
297
|
+
Mode: [full / update / tokens-only / export]
|
|
298
|
+
|
|
299
|
+
[Discovery collected]
|
|
300
|
+
[Spawning ctx-designer — brand workflow]
|
|
301
|
+
|
|
302
|
+
[Gate 1] Mood board → waiting for approval
|
|
303
|
+
[Gate 2] Direction selection → waiting for approval
|
|
304
|
+
[Gate 3] Contrast audit → auto
|
|
305
|
+
[Gate 4] BRAND_KIT.md final → waiting for approval
|
|
306
|
+
|
|
307
|
+
[Agent output follows]
|
|
308
|
+
```
|
|
309
|
+
</output>
|