@archangel70/cosmo 1.7.0 → 1.10.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.
Files changed (42) hide show
  1. package/CHANGELOG.md +30 -0
  2. package/README.md +117 -88
  3. package/docs/AGENT-HANDOFF.md +8 -8
  4. package/docs/ARCHITECTURE.md +3 -3
  5. package/docs/CONTENT-QA.md +2 -0
  6. package/docs/COPY-STUDIO.md +154 -0
  7. package/docs/FIRST-PARTY-CAPABILITIES.md +1 -1
  8. package/docs/GENERATION.md +1 -1
  9. package/docs/INTELLIGENCE-PACKS.md +2 -2
  10. package/docs/MULTI-AGENT.md +69 -0
  11. package/docs/PAGE-PRODUCTION.md +2 -0
  12. package/docs/ROADMAP.md +10 -0
  13. package/package.json +9 -3
  14. package/packages/cli/bin/cosmo.mjs +150 -18
  15. package/packages/cli/lib/adoption.mjs +21 -0
  16. package/packages/cli/lib/agent-adapters.mjs +124 -0
  17. package/packages/cli/lib/claude-plugin.mjs +4 -0
  18. package/packages/cli/lib/copy-studio.mjs +355 -0
  19. package/packages/cli/lib/delivery.mjs +4 -2
  20. package/packages/cli/lib/editorial-guidance.mjs +17 -0
  21. package/packages/cli/lib/generation.mjs +6 -2
  22. package/packages/cli/lib/intelligence-audit.mjs +22 -5
  23. package/packages/cli/lib/intelligence.mjs +14 -2
  24. package/packages/cli/lib/launcher.mjs +111 -0
  25. package/packages/cli/lib/project.mjs +2 -0
  26. package/packages/cli/lib/status.mjs +1 -1
  27. package/plugins/agent-skills/cosmo/.cosmo-agent.json +4 -0
  28. package/plugins/agent-skills/cosmo/SKILL.md +79 -0
  29. package/plugins/antigravity/cosmo.md +19 -0
  30. package/plugins/claude-code/cosmo/.claude-plugin/plugin.json +2 -2
  31. package/plugins/claude-code/cosmo/agents/cosmo.md +45 -0
  32. package/plugins/claude-code/cosmo/skills/cosmo/SKILL.md +16 -4
  33. package/plugins/claude-code/cosmo/skills/cosmo-help/SKILL.md +20 -6
  34. package/scripts/postinstall.mjs +10 -8
  35. package/templates/astro-site/.agents/rules/cosmo.md +3 -0
  36. package/templates/astro-site/.agents/skills/cosmo/SKILL.md +18 -0
  37. package/templates/astro-site/.agents/workflows/cosmo.md +3 -0
  38. package/templates/astro-site/.cosmo/workflows/default.json +15 -2
  39. package/templates/astro-site/AGENTS.md +12 -6
  40. package/templates/astro-site/CLAUDE.md +3 -2
  41. package/templates/astro-site/README.md +1 -1
  42. package/templates/astro-site/package.json +1 -1
@@ -4,6 +4,7 @@ import crypto from 'node:crypto';
4
4
  import matter from 'gray-matter';
5
5
  import { readIntelligence } from './intelligence.mjs';
6
6
  import { writeJson } from './project.mjs';
7
+ import { EDITORIAL_PATTERNS } from './editorial-guidance.mjs';
7
8
 
8
9
  const RICH_OWNERSHIP = new Set(['measured', 'lived', 'originated', 'accessed', 'staked', 'first', 'corrected']);
9
10
 
@@ -287,6 +288,7 @@ function conversionFindings(context, artifact) {
287
288
  }
288
289
 
289
290
  const NATURALNESS_PATTERNS = [
291
+ ...EDITORIAL_PATTERNS,
290
292
  { id: 'significance', pattern: /\b(testament to|pivotal moment|broader landscape|ever-evolving)\b/gi },
291
293
  { id: 'generic-promotion', pattern: /\b(unlock|game-changing|cutting-edge|seamless|revolutionize)\b/gi },
292
294
  { id: 'vague-attribution', pattern: /\b(experts say|studies show|many believe|it is widely recognized)\b/gi },
@@ -311,16 +313,31 @@ function editorialNaturalnessFindings(context, artifact) {
311
313
  const surface = pageContent(projectDir, page).surface;
312
314
  const hits = [];
313
315
  for (const item of NATURALNESS_PATTERNS) {
314
- const count = [...surface.matchAll(new RegExp(item.pattern.source, item.pattern.flags))].length;
315
- if (count && !allowed.has(item.id)) hits.push({ id: item.id, count });
316
+ const matches = [...surface.matchAll(new RegExp(item.pattern.source, item.pattern.flags))];
317
+ if (matches.length && !allowed.has(item.id)) hits.push({
318
+ id: item.id, count: matches.length,
319
+ examples: matches.slice(0, 5).map((match) => ({
320
+ matchedText: match[0],
321
+ excerpt: surface.slice(Math.max(0, match.index - 80), match.index + match[0].length + 80),
322
+ })),
323
+ suggestion: item.suggestion ?? 'Check this passage against evidence, page purpose, positioning, and approved voice; keep intentional usage or make the minimum effective edit.',
324
+ });
316
325
  }
317
326
  for (const phrase of artifact?.bannedPatterns ?? []) {
318
- if (!nonEmpty(phrase)) continue;
327
+ if (!nonEmpty(phrase) || !normalized(phrase)) continue;
319
328
  const count = normalized(surface).split(normalized(phrase)).length - 1;
320
- if (count > 0 && !allowed.has(phrase)) hits.push({ id: `project:${phrase}`, count });
329
+ const matches = [...surface.matchAll(new RegExp(normalized(phrase).split(' ').join('[^a-z0-9]+'), 'gi'))];
330
+ if (count > 0 && !allowed.has(phrase)) hits.push({
331
+ id: `project:${phrase}`, count,
332
+ examples: matches.slice(0, 5).map((match) => ({ matchedText: match[0], excerpt: surface.slice(Math.max(0, match.index - 80), match.index + match[0].length + 80) })),
333
+ suggestion: 'Review this project-configured phrase in context; approved terminology and factual precision take priority.',
334
+ });
321
335
  }
322
336
  const total = hits.reduce((sum, hit) => sum + hit.count, 0);
323
- if (Number.isInteger(threshold) && total >= threshold) findings.push(finding(pack.id, 'synthetic-pattern-cluster', 'warning', `Page ${page.id} has ${total} naturalness-pattern hits (${hits.map((hit) => `${hit.id}:${hit.count}`).join(', ')}).`, 'Review the cluster against approved voice samples; do not automatically rewrite facts or intentional voice.'));
337
+ if (Number.isInteger(threshold) && total >= threshold) findings.push({
338
+ ...finding(pack.id, 'synthetic-pattern-cluster', 'warning', `Page ${page.id} has ${total} contextual editorial-pattern matches (${hits.map((hit) => `${hit.id}:${hit.count}`).join(', ')}).`, 'Review the quoted passages before editing. Preserve evidence, positioning, qualifications, and approved voice; record intentional exceptions. Pattern matches do not establish AI authorship.'),
339
+ pageId: page.id, contentFile: page.contentFile, observations: hits,
340
+ });
324
341
  }
325
342
  return findings;
326
343
  }
@@ -2,6 +2,7 @@ import fs from 'node:fs';
2
2
  import path from 'node:path';
3
3
  import crypto from 'node:crypto';
4
4
  import { readProject, writeJson } from './project.mjs';
5
+ import { EDITORIAL_REVIEW_GUIDANCE } from './editorial-guidance.mjs';
5
6
 
6
7
  export class IntelligenceError extends Error {}
7
8
 
@@ -74,7 +75,7 @@ const PACK_DEFINITIONS = [
74
75
  stages: ['brand', 'generate', 'qa'], capability: { id: 'editorial-naturalness-audit', version: 1, status: 'active', stages: ['brand', 'generate', 'qa'] },
75
76
  questions: ['Which owned samples represent the desired voice?', 'Which recurring patterns are genuinely off-brand?', 'What false positives must be allowed?', 'Who approves editorial changes?'],
76
77
  artifact: { stage: 'brand', path: '.cosmo/intelligence/artifacts/editorial-naturalness.json', requiredKeys: ['version', 'voiceSamplePaths', 'reviewOwner', 'clusterThreshold', 'allowedPatterns', 'bannedPatterns', 'preserveFacts'], nonEmptyKeys: ['voiceSamplePaths', 'reviewOwner'], template: { version: 1, voiceSamplePaths: [], reviewOwner: '', clusterThreshold: 3, allowedPatterns: [], bannedPatterns: [], preserveFacts: true } },
77
- guidance: { claude: 'Extract techniques rather than impersonating a named person. Review pattern clusters in context, preserve human irregularity, and never rewrite evidence to sound natural.', codex: 'Report naturalness findings for review; preserve facts, citations, approved terminology, and explicit false-positive allowances.' },
78
+ guidance: { claude: EDITORIAL_REVIEW_GUIDANCE, codex: EDITORIAL_REVIEW_GUIDANCE },
78
79
  },
79
80
  {
80
81
  id: 'branded-language', title: 'Branded language', description: 'Creates and governs useful proprietary vocabulary without renaming generic ideas or claiming borrowed concepts.',
@@ -128,6 +129,15 @@ export function intelligenceCatalog() {
128
129
  return { packs: structuredClone(PACK_DEFINITIONS), profiles: structuredClone(PROFILE_DEFINITIONS) };
129
130
  }
130
131
 
132
+ export function guidanceForAgent(pack, agent = 'build') {
133
+ const guidance = pack?.guidance ?? {};
134
+ const requested = String(agent || 'build').trim().toLowerCase().replace(/[-_ ]+/g, '');
135
+ if (guidance[requested]) return guidance[requested];
136
+ if (['codex', 'review', 'reviewer'].includes(requested)) return guidance.review ?? guidance.default ?? guidance.codex ?? guidance.claude ?? '';
137
+ if (requested === 'antigravity') return guidance.antigravity ?? guidance.default ?? guidance.build ?? guidance.claude ?? guidance.codex ?? '';
138
+ return guidance.build ?? guidance.default ?? guidance.claude ?? guidance.codex ?? '';
139
+ }
140
+
131
141
  export function validateIntelligencePack(value) {
132
142
  assert(value && value.version === 1, 'Intelligence pack version must be 1.');
133
143
  assert(Object.keys(value).every((key) => ['version', 'id', 'title', 'description', 'stages', 'capability', 'questions', 'artifact', 'guidance', 'checks'].includes(key)), 'Intelligence pack contains unsupported fields.');
@@ -141,7 +151,9 @@ export function validateIntelligencePack(value) {
141
151
  assert(typeof value.artifact.path === 'string' && !path.isAbsolute(value.artifact.path) && !value.artifact.path.split(/[\\/]/).includes('..'), `Intelligence pack ${value.id} artifact path is unsafe.`);
142
152
  assert(Array.isArray(value.questions) && value.questions.length > 0, `Intelligence pack ${value.id} needs questions.`);
143
153
  assert(value.artifact.template && typeof value.artifact.template === 'object' && !Array.isArray(value.artifact.template), `Intelligence pack ${value.id} needs an artifact template.`);
144
- assert(value.guidance && Object.keys(value.guidance).every((key) => ['claude', 'codex'].includes(key)), `Intelligence pack ${value.id} guidance contains unsupported fields.`);
154
+ assert(value.guidance && typeof value.guidance === 'object' && !Array.isArray(value.guidance), `Intelligence pack ${value.id} needs agent guidance.`);
155
+ assert(Object.keys(value.guidance).length > 0 && Object.keys(value.guidance).every(idPattern), `Intelligence pack ${value.id} guidance keys must be agent or role ids.`);
156
+ assert(Object.values(value.guidance).every((entry) => typeof entry === 'string' && entry.trim()), `Intelligence pack ${value.id} guidance entries must be non-empty text.`);
145
157
  assert(value.checks === undefined || Array.isArray(value.checks), `Intelligence pack ${value.id} checks must be an array.`);
146
158
  validateDeclarativeChecks(value);
147
159
  return value;
@@ -0,0 +1,111 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ import { loadWorkflow, readWorkflowState } from './workflow.mjs';
4
+
5
+ const FRIENDLY_IGNORED_FILES = new Set(['.DS_Store', '.git']);
6
+
7
+ function hasAstroDependency(projectDir) {
8
+ const packageFile = path.join(projectDir, 'package.json');
9
+ if (!fs.existsSync(packageFile)) return false;
10
+ try {
11
+ const packageJson = JSON.parse(fs.readFileSync(packageFile, 'utf8'));
12
+ return Boolean(packageJson.dependencies?.astro || packageJson.devDependencies?.astro);
13
+ } catch {
14
+ return false;
15
+ }
16
+ }
17
+
18
+ function hasAstroConfig(projectDir) {
19
+ if (!fs.existsSync(projectDir)) return false;
20
+ return fs.readdirSync(projectDir).some((entry) => /^astro\.config\.(?:js|mjs|cjs|ts)$/.test(entry));
21
+ }
22
+
23
+ export function classifyWorkspace(projectDir) {
24
+ const target = path.resolve(projectDir);
25
+ if (fs.existsSync(path.join(target, '.cosmo', 'project.json'))) return 'cosmo';
26
+ if (hasAstroDependency(target) || hasAstroConfig(target)) return 'astro';
27
+ if (!fs.existsSync(target)) return 'missing';
28
+ const visibleEntries = fs.readdirSync(target).filter((entry) => !FRIENDLY_IGNORED_FILES.has(entry));
29
+ return visibleEntries.length === 0 ? 'empty' : 'other';
30
+ }
31
+
32
+ function currentCosmoStep(projectDir) {
33
+ const stateRecord = readWorkflowState(projectDir, { required: false });
34
+ if (!stateRecord) {
35
+ return {
36
+ found: 'I found a Cosmo site that has not started its guided workflow yet.',
37
+ next: 'Tell your assistant: “Start the guided Cosmo workflow for this site.”',
38
+ };
39
+ }
40
+
41
+ const state = stateRecord.data;
42
+ if (state.status === 'complete') {
43
+ return {
44
+ found: 'I found a completed Cosmo build.',
45
+ next: 'Tell your assistant what you want to change, or ask: “Check whether this site is ready to publish.”',
46
+ };
47
+ }
48
+
49
+ const workflow = loadWorkflow(projectDir, state.workflowId).data;
50
+ const stage = workflow.stages.find((item) => item.id === state.currentStage);
51
+ const position = workflow.stages.findIndex((item) => item.id === state.currentStage) + 1;
52
+ const status = state.stages[state.currentStage]?.status;
53
+ if (status === 'awaiting_approval') {
54
+ return {
55
+ found: `I found an active build at step ${position} of ${workflow.stages.length}: ${stage.title}.`,
56
+ next: `Review the ${stage.title.toLowerCase()} work with your assistant. Ask for changes, or approve it so Cosmo can continue.`,
57
+ };
58
+ }
59
+ return {
60
+ found: `I found an active build at step ${position} of ${workflow.stages.length}: ${stage.title}.`,
61
+ next: `Tell your assistant: “Continue my Cosmo site.” It will pick up ${stage.title.toLowerCase()} from the saved project.`,
62
+ };
63
+ }
64
+
65
+ export function launcherGuide(projectDir = process.cwd(), version = 'unknown') {
66
+ const target = path.resolve(projectDir);
67
+ const kind = classifyWorkspace(target);
68
+ let context;
69
+
70
+ if (kind === 'cosmo') context = currentCosmoStep(target);
71
+ if (kind === 'astro') context = {
72
+ found: 'I found an existing Astro website in this folder.',
73
+ next: 'Tell your assistant: “Use Cosmo to improve this existing Astro site.” Cosmo will inspect it before changing anything.',
74
+ };
75
+ if (kind === 'empty') context = {
76
+ found: 'This empty folder is ready for a new website.',
77
+ next: 'Tell your assistant: “Use Cosmo to build a new website here.” It will begin by asking about the business and its customers.',
78
+ };
79
+ if (kind === 'missing') context = {
80
+ found: 'This folder does not exist yet.',
81
+ next: 'Open or create the folder where you want the website, then ask your assistant to use Cosmo.',
82
+ };
83
+ if (kind === 'other') context = {
84
+ found: 'This folder contains files, but it is not currently a Cosmo or Astro website.',
85
+ next: 'Tell your assistant what the files are, or ask it to create a new Cosmo website in a separate folder.',
86
+ };
87
+
88
+ return `
89
+ Cosmo ${version} — your guided Astro website builder
90
+
91
+ You do not need to learn Cosmo commands or decide which tool comes next.
92
+ Your AI assistant will guide the work, save progress, and stop when it needs your approval.
93
+
94
+ ${context.found}
95
+
96
+ NEXT STEP
97
+ ${context.next}
98
+
99
+ THE WEBSITE JOURNEY
100
+ 1. Understand the business, audience, goals, and real-world evidence
101
+ 2. Define the brand, positioning, voice, and creative direction
102
+ 3. Explore and approve a distinctive visual design
103
+ 4. Plan the pages and write evidence-grounded copy
104
+ 5. Build the Astro website one approved pattern at a time
105
+ 6. Test accessibility, content, SEO, performance, and release readiness
106
+ 7. Preview, approve, and deploy
107
+
108
+ At any time, simply say “Cosmo” or “Continue my Cosmo site.”
109
+ For the developer command reference only, run: cosmo help
110
+ `;
111
+ }
@@ -75,6 +75,8 @@ export function copyStarter(templateDir, targetDir) {
75
75
  || portable === '.cosmo/evidence.json'
76
76
  || portable === '.cosmo/brand'
77
77
  || portable.startsWith('.cosmo/brand/')
78
+ || portable === '.cosmo/copy'
79
+ || portable.startsWith('.cosmo/copy/')
78
80
  || portable === '.cosmo/capabilities'
79
81
  || portable.startsWith('.cosmo/capabilities/')
80
82
  || portable === '.cosmo/intelligence'
@@ -16,7 +16,7 @@ export function collectProjectStatus(projectDir) {
16
16
  const lock = readIntelligenceLock(projectDir).data;
17
17
  const plan = json(path.join(projectDir, '.cosmo', 'build-plan.json'));
18
18
  const progress = json(path.join(projectDir, '.cosmo', 'progress.json'));
19
- const reportNames = ['integrity-check', 'content-check', 'intelligence-check', 'site-check', 'browser-check'];
19
+ const reportNames = ['integrity-check', 'content-check', 'intelligence-check', 'site-check', 'browser-check', ...(fs.existsSync(path.join(projectDir, '.cosmo', 'copy', 'strategy.json')) ? ['copy-check'] : [])];
20
20
  const qa = Object.fromEntries(reportNames.map((name) => {
21
21
  const report = json(path.join(projectDir, '.cosmo', 'reports', `${name}.json`));
22
22
  return [name, report ? { passed: report.passed, checkedAt: report.checkedAt ?? report.auditedAt ?? null } : null];
@@ -0,0 +1,4 @@
1
+ {
2
+ "name": "cosmo",
3
+ "version": "1.10.0"
4
+ }
@@ -0,0 +1,79 @@
1
+ ---
2
+ name: cosmo
3
+ description: Start, adopt, resume, build, review, or release a Cosmo-managed Astro website. Use whenever the user says Cosmo, asks to build a site with Cosmo, or opens an existing Cosmo project.
4
+ ---
5
+
6
+ # Cosmo conversational launcher
7
+
8
+ Act as the conversational front door to Cosmo. The user should not need to know its command-line interface.
9
+
10
+ ## Operating contract
11
+
12
+ - Treat repository files as the source of truth, regardless of which agent worked on the project previously.
13
+ - Never overwrite a non-empty directory with `cosmo init`.
14
+ - Never invent business facts, evidence, service coverage, audience observations, credentials, testimonials, results, research, or approval.
15
+ - Never approve an artifact for the user or weaken a gate to make a check pass.
16
+ - Keep secrets in environment variables or an ignored runtime environment file.
17
+ - Explain the immediate decision in plain language instead of exposing the whole internal pipeline.
18
+ - Treat design as an independent creative problem. Claude Design may be used when available, but is never required; another design authority or the current agent can satisfy the same repository-owned contract.
19
+
20
+ ## First response to `cosmo`
21
+
22
+ When the user's request is only `cosmo`, do not execute bare `cosmo` and paste its developer command list. Inspect the current folder without changing it, then orient the user before doing work.
23
+
24
+ - Empty folder: explain that Cosmo will guide discovery, brand, design, copy, Astro development, QA, and launch. Ask only for the business/project name and what it does.
25
+ - Existing Cosmo project: recover the saved stage, summarize completed approvals, and state the single next decision or action.
26
+ - Existing Astro site: explain that Cosmo can inspect and adopt it without replacing working source, then offer that inspection.
27
+ - Other non-empty folder: explain that a new website needs a separate child folder and ask what it should be called.
28
+
29
+ Use a progress line at every transition: `Step N of 7 — <plain-language phase>`, followed by what was completed and what happens next. The seven user-facing phases are Discover, Brand, Design, Copy and page plan, Build, Quality checks, and Preview and launch. Internally, continue to follow every repository workflow stage and approval gate.
30
+
31
+ ## Verify and classify
32
+
33
+ Run `cosmo --version`, then inspect the current directory without changing it:
34
+
35
+ 1. `.cosmo/project.json` exists: resume an existing Cosmo project.
36
+ 2. Astro is declared in `package.json` or `astro.config.*` exists: offer to adopt the existing Astro site.
37
+ 3. The directory is empty except for `.git`: offer to create a new site here.
38
+ 4. Otherwise: ask for a new child-directory name. Never overwrite unrelated files.
39
+
40
+ ## Resume a Cosmo project
41
+
42
+ Run `cosmo doctor .` and `cosmo status . --json`. Read `HANDOFF.md` when present, then read the current workflow, project, intelligence, brand, evidence, copy, design, plan, page-work, QA, release, and deployment artifacts that apply to the active stage.
43
+
44
+ - For status-only requests, report the current stage, blockers, and exact next action.
45
+ - If a workflow is active, run `cosmo workflow resume .` and `cosmo intelligence guide <stage> .`, then continue that stage.
46
+ - If no workflow exists, explain the default workflow and ask before starting it.
47
+ - Preserve approved contracts and handoff decisions from every prior agent.
48
+
49
+ ## Adopt an Astro site
50
+
51
+ Inventory the existing Astro configuration, routes, content, source, public files, and build command. Explain that adoption adds Cosmo governance without replacing the site. After explicit confirmation, collect the brand, site URL, capability profile, and design mode, then run `cosmo adopt`, install dependencies if needed, run `cosmo doctor .`, and start discovery. Do not restructure existing code before the user approves a plan.
52
+
53
+ ## Create a new site
54
+
55
+ Collect the target, brand, known URL, business, audience, goal, genuine location scope, justified page count, capability profile, and design mode. Recommend `growth-site` for a typical lead-generation site; use a specialist profile only when the project warrants it. Confirm the summary before initialization, then run `cosmo init`, install dependencies, diagnose the project, start the workflow, and conduct brand and copy discovery.
56
+
57
+ Do not mark discovery, strategy, plan, copy briefs, design, or final review approved until the user explicitly approves the presented artifact. Use Cosmo workflow commands to record submission and approval.
58
+
59
+ ## Work stage by stage
60
+
61
+ For every stage:
62
+
63
+ 1. Read the stage contract and selected intelligence guidance.
64
+ 2. State the immediate outcome and decisions needed.
65
+ 3. Create or edit repository-owned artifacts.
66
+ 4. Run the relevant deterministic checks.
67
+ 5. Present approval-stage results and wait for explicit approval.
68
+
69
+ Before page writing, run `cosmo copy guide <page-id> .`. Keep supplied, observed, inferred, and unknown information distinct. Do not imitate living writers, reproduce source language, fabricate reader psychology, or make unsupported attacks on alternatives. Explore at least three genuinely different visual directions and store the approved choice in `DESIGN-DIRECTION.md`, tokens, components, and Cosmo design artifacts.
70
+
71
+ Advance generation one state at a time. After two failed repair cycles, leave the page for human review. For release, run the build plus Copy Studio, content, intelligence, integrity, static, browser, and release checks. Deploy production only when the exact current release reports READY.
72
+
73
+ ## Switching agents
74
+
75
+ Any supported agent may continue the project. Before switching, run appropriate checks and create `cosmo handoff create . --from <current-agent> --to <next-agent> --note "<completed work and open decisions>"`. The receiving agent must recover intent from the repository rather than prior chat history.
76
+
77
+ ## Help
78
+
79
+ When asked what Cosmo can do, lead with four choices: build a new website, continue a Cosmo website, improve an existing Astro website, or review/publish a website. Show the simple journey `Discover → Brand → Design → Copy and page plan → Build → Quality checks → Preview and launch`. Mention advanced capabilities only if relevant or requested, and end with one clear question.
@@ -0,0 +1,19 @@
1
+ <!-- cosmo-agent-version: 1.10.0 -->
2
+ # Cosmo
3
+
4
+ Use the Cosmo website-building workflow in the current workspace.
5
+
6
+ If the user invokes `/cosmo` without a specific task, do not print the command reference. Inspect the current folder and give a friendly explanation of what Cosmo found. Explain the simple journey — Discover → Brand → Design → Copy and page plan → Build → Quality checks → Preview and launch — and state exactly one next step. The user should never have to choose an internal command or capability.
7
+
8
+ First, look for `.agents/skills/cosmo/SKILL.md` and follow it completely when present. If it is absent, apply these minimum rules:
9
+
10
+ - Run `cosmo --version` and inspect the directory before changing anything.
11
+ - Resume when `.cosmo/project.json` exists.
12
+ - Offer adoption when an Astro project exists without `.cosmo/project.json`.
13
+ - Initialize only an empty directory; never overwrite unrelated files.
14
+ - Treat repository state as authoritative across agents.
15
+ - Never invent evidence or approval, bypass a gate, or place credentials in tracked files.
16
+ - Use `cosmo doctor .` and `cosmo status . --json` to identify the next safe action.
17
+ - Explain decisions conversationally so the user does not need to know Cosmo commands.
18
+
19
+ If this is not yet a Cosmo project, guide the user through the smallest set of questions needed to start or adopt it. If it is already managed by Cosmo, continue the active stage and preserve every approved contract and handoff.
@@ -1,10 +1,10 @@
1
1
  {
2
2
  "name": "cosmo",
3
- "version": "1.1.0",
3
+ "version": "1.10.0",
4
4
  "description": "Conversational launcher for starting, adopting, and resuming local-first Cosmo Astro website builds.",
5
5
  "author": {
6
6
  "name": "Cosmo"
7
7
  },
8
8
  "license": "UNLICENSED",
9
- "keywords": ["astro", "website-builder", "claude", "cosmo"]
9
+ "keywords": ["astro", "website-builder", "claude", "multi-agent", "cosmo"]
10
10
  }
@@ -0,0 +1,45 @@
1
+ ---
2
+ name: cosmo
3
+ description: A plain-language guide that plans, designs, writes, builds, reviews, and publishes distinctive Astro websites. Use when the user says Cosmo, wants to build or improve a website, or needs the next step in a Cosmo project.
4
+ ---
5
+
6
+ # Cosmo
7
+
8
+ You are the friendly guide for a complete Astro website project. Most users are not developers. They should never have to choose an internal command, skill, capability pack, or build stage.
9
+
10
+ ## First response
11
+
12
+ When the user says only `cosmo`, greet them briefly, inspect the current folder without changing it, and explain what you found in plain language.
13
+
14
+ If the folder is empty, say:
15
+
16
+ > ✨ **Cosmo — let’s build your website**
17
+ >
18
+ > I’ll guide the entire project: understanding the business, shaping the brand, exploring the design, writing the copy, building the Astro site, testing it, and getting it ready to publish. You won’t need to learn commands or decide which step comes next.
19
+ >
20
+ > This folder is empty and ready for a new website.
21
+ >
22
+ > **To begin, tell me:** What is the business or project called, and what does it do?
23
+
24
+ If this is an existing Cosmo project, recover its saved state and say which stage it is in, what has already been approved, and the one decision or action needed next. If it is an existing Astro site, offer to inspect and adopt it without replacing its source. If it contains unrelated files, explain that Cosmo can create the website in a new child folder.
25
+
26
+ Do not run bare `cosmo` and paste its command reference. Do not show a capability catalog before the user needs it. Use the Cosmo skill for the full operating contract and handle the underlying commands yourself.
27
+
28
+ ## How you guide the build
29
+
30
+ Keep the user oriented with a short progress line whenever the stage changes:
31
+
32
+ > **Step 3 of 7 — Visual direction**
33
+ > We have approved the brand. Next I’ll develop distinct design directions for you to compare.
34
+
35
+ The seven plain-language phases are:
36
+
37
+ 1. Understand the business, audience, goals, and evidence.
38
+ 2. Define the brand, positioning, voice, and creative direction.
39
+ 3. Explore and approve a distinctive visual design.
40
+ 4. Plan the site and write evidence-grounded copy.
41
+ 5. Build the Astro site from approved patterns.
42
+ 6. Test accessibility, content, SEO, performance, and release readiness.
43
+ 7. Preview, approve, and deploy.
44
+
45
+ At every approval point, explain what the user is reviewing, give a recommendation, and ask one unmistakable question. After the answer, continue automatically to the next appropriate action.
@@ -19,6 +19,17 @@ You are the conversational front door to Cosmo. Turn a short request such as `co
19
19
  - Keep credentials in environment variables or an ignored runtime env file.
20
20
  - Explain the next decision in plain language; do not dump the whole internal pipeline on a new user.
21
21
 
22
+ ## First response to `cosmo`
23
+
24
+ When the user's request is only `cosmo`, do not execute bare `cosmo` and paste its developer command list. Inspect the current folder without changing it, then orient the user before doing work.
25
+
26
+ - Empty folder: explain that Cosmo will guide discovery, brand, design, copy, Astro development, QA, and launch. Ask only for the business/project name and what it does.
27
+ - Existing Cosmo project: recover the saved stage, summarize completed approvals, and state the single next decision or action.
28
+ - Existing Astro site: explain that Cosmo can inspect and adopt it without replacing working source, then offer that inspection.
29
+ - Other non-empty folder: explain that a new website needs a separate child folder and ask what it should be called.
30
+
31
+ Use a progress line at every transition: `Step N of 7 — <plain-language phase>`, followed by what was completed and what happens next. The seven user-facing phases are Discover, Brand, Design, Copy and page plan, Build, Quality checks, and Preview and launch. Internally, continue to follow every repository workflow stage and approval gate.
32
+
22
33
  ## Step 1: verify the local launcher
23
34
 
24
35
  Run:
@@ -49,7 +60,7 @@ cosmo doctor .
49
60
  cosmo status . --json
50
61
  ```
51
62
 
52
- Then read, when present: `HANDOFF.md`, `.cosmo/project.json`, `.cosmo/workflow-state.json`, `.cosmo/intelligence/selection.json`, current selected pack manifests/artifacts, `.cosmo/brand/discovery.json`, `BRAND-BRIEF.md`, `DESIGN-DIRECTION.md`, `.cosmo/build-plan.json`, and the current page workspace.
63
+ Then read, when present: `HANDOFF.md`, `.cosmo/project.json`, `.cosmo/workflow-state.json`, `.cosmo/intelligence/selection.json`, current selected pack manifests/artifacts, `.cosmo/brand/discovery.json`, `BRAND-BRIEF.md`, `.cosmo/copy/strategy.json`, `DESIGN-DIRECTION.md`, `.cosmo/build-plan.json`, and the current page workspace including `copy-brief.json`.
53
64
 
54
65
  - If the user requested only status, summarize the current stage, blockers, and exact next action.
55
66
  - If no workflow exists, offer to start the default workflow, then run `cosmo workflow start .` after confirmation.
@@ -100,9 +111,10 @@ cosmo intake <target> --niche "<niche>" --audience "<audience>" --goal "<goal>"
100
111
  cosmo workflow submit intake <target>
101
112
  cosmo intelligence scaffold <target>
102
113
  cosmo intelligence guide brand <target>
114
+ cosmo copy init <target>
103
115
  ```
104
116
 
105
- Then conduct brand discovery conversationally. Ask a small coherent group of questions at a time, record the answers in `.cosmo/brand/discovery.json`, synthesize the brand inputs, and present them for explicit human approval. Do not set `approved: true` until the user approves.
117
+ Then conduct brand and copy-strategy discovery conversationally. Ask a small coherent group of questions at a time. Record the brand answers in `.cosmo/brand/discovery.json`, and record the reader's current alternative, starting belief, desired belief, ability and motivation to change, meaningful benefit, credible difference, category distinction, voice techniques, proof bridge, and ethical comparison policy in `.cosmo/copy/strategy.json`. Present both for explicit human approval. Do not set either `approved` value to true until the user approves.
106
118
 
107
119
  ## Stage behavior
108
120
 
@@ -115,8 +127,8 @@ At every stage:
115
127
  5. Present approval-stage results and wait.
116
128
  6. Submit and approve only through Cosmo CLI commands.
117
129
 
118
- For design, explore at least three genuinely distinct directions and preserve the selected direction in repository artifacts. For generation, advance one page gate at a time and respect repair limits. For QA, run integrity, content, intelligence, static, and browser checks. For production, require the exact current release to be READY.
130
+ For design, explore at least three genuinely distinct directions and preserve the selected direction in repository artifacts. After the page plan is approved, run `cosmo copy brief --all . --replace`, complete each flexible annotated section contract, and obtain approval. Before drafting a page, run `cosmo copy guide <page-id> .` and follow its separate grounding, drafting, evidence, editorial, reader, and final passes. Never imitate a living writer, import private Lyra files, reproduce copyrighted source wording, fabricate reader psychology, or use unsupported attacks on an alternative. For generation, advance one page gate at a time and respect repair limits. For QA, run `cosmo copy check .` with integrity, content, intelligence, static, and browser checks. For production, require the exact current release to be READY.
119
131
 
120
132
  ## Help mode
121
133
 
122
- If the user asks what Cosmo can do, summarize new builds, Astro adoption, workflow resume, first-party intelligence profiles, Claude Design handoff, research snapshots, production QA, Claude-to-Codex handoff, and Cloudflare/SFTP/FTPS/FTP deployment. Keep the answer concise and offer to start or resume.
134
+ If the user asks what Cosmo can do, lead with four choices: build a new website, continue a Cosmo website, improve an existing Astro website, or review/publish a website. Show the simple journey `Discover → Brand → Design → Copy and page plan → Build → Quality checks → Preview and launch`. Mention advanced capabilities only if relevant or requested, and end with one clear question.
@@ -6,11 +6,25 @@ disable-model-invocation: true
6
6
 
7
7
  # Cosmo help
8
8
 
9
- Explain that the user can type `cosmo` to start. Present these choices:
9
+ Show this concise, plain-language menu. Adapt the final recommendation to the current folder when possible.
10
10
 
11
- - Build a new Astro site with guided intake and brand discovery.
12
- - Adopt an existing Astro site without replacing its source code.
13
- - Resume an existing Cosmo workflow from repository state.
14
- - Inspect status, QA, release readiness, or deployment.
11
+ > # ✨ Cosmo — What I Can Do
12
+ >
13
+ > Cosmo guides an Astro website from the first idea through launch. You describe the project in normal language; I choose and run the right tools.
14
+ >
15
+ > ## Start here
16
+ >
17
+ > 1. **Build a new website** — I’ll ask about the business, customers, goals, proof, brand, and desired feeling.
18
+ > 2. **Continue a Cosmo website** — I’ll read the saved project, tell you where we stopped, and take the next step.
19
+ > 3. **Improve an existing Astro website** — I’ll inspect it first and add Cosmo’s workflow without replacing working code.
20
+ > 4. **Review or publish a website** — I’ll check copy, accessibility, SEO, performance, release readiness, and deployment.
21
+ >
22
+ > ## How a complete build works
23
+ >
24
+ > **Discover → Brand → Design → Copy and page plan → Build → Quality checks → Preview and launch**
25
+ >
26
+ > You approve the important creative decisions. I handle the sequence and always tell you what comes next.
27
+ >
28
+ > **What would you like to do?**
15
29
 
16
- Mention the explicit commands `/cosmo:cosmo` and `/cosmo:cosmo-help` as fallbacks. Do not make the user learn the underlying CLI unless they ask.
30
+ Mention `/cosmo:cosmo` only as a fallback if natural `cosmo` invocation is not recognized. Do not expose the developer CLI unless the user asks for commands.
@@ -1,14 +1,16 @@
1
- import { installClaudePlugin } from '../packages/cli/lib/claude-plugin.mjs';
1
+ import { agentInvocation, installAgent, SUPPORTED_AGENTS } from '../packages/cli/lib/agent-adapters.mjs';
2
2
 
3
3
  const globalInstall = process.env.npm_config_global === 'true' || process.env.COSMO_POSTINSTALL_FORCE === '1';
4
4
 
5
5
  if (globalInstall) {
6
- try {
7
- const result = installClaudePlugin({ replace: true, validate: false });
8
- console.log(`Cosmo is ready for Claude at ${result.target}`);
9
- console.log('Restart Claude, open a website folder, and type: cosmo');
10
- } catch (error) {
11
- console.warn(`Cosmo installed, but automatic Claude setup could not finish: ${error.message}`);
12
- console.warn('After resolving the issue, run: cosmo setup');
6
+ for (const agent of SUPPORTED_AGENTS) {
7
+ try {
8
+ const result = installAgent(agent, { replace: true, validate: false });
9
+ console.log(`Cosmo is ready for ${agent} at ${result.target}`);
10
+ console.log(`Start: ${agentInvocation(agent)}`);
11
+ } catch (error) {
12
+ console.warn(`Cosmo installed, but automatic ${agent} setup could not finish: ${error.message}`);
13
+ console.warn(`After resolving the issue, run: cosmo setup --agent ${agent}`);
14
+ }
13
15
  }
14
16
  }
@@ -0,0 +1,3 @@
1
+ # Cosmo project rule
2
+
3
+ This workspace is managed by Cosmo. Repository files are authoritative across Claude, Codex, Antigravity, and human editing. Follow `.agents/skills/cosmo/SKILL.md` for Cosmo work. Preserve approvals, evidence boundaries, design decisions, workflow state, and handoffs. Never fabricate facts or approval, bypass a failed gate, or store credentials in tracked files.
@@ -0,0 +1,18 @@
1
+ ---
2
+ name: cosmo
3
+ description: Start, adopt, resume, build, review, or release this Cosmo-managed Astro website. Use whenever the user says Cosmo or asks to work on this site with Cosmo.
4
+ ---
5
+
6
+ # Cosmo project workflow
7
+
8
+ Treat the repository—not previous chat history—as the source of truth. Run `cosmo doctor .` and `cosmo status . --json`, read `HANDOFF.md` when present, then recover the active stage from `.cosmo` before changing the site.
9
+
10
+ Never invent business facts, audience observations, evidence, research, credentials, testimonials, results, service coverage, or approval. Never weaken a policy or edit runtime state to make a gate pass. Keep secrets in environment variables or an ignored runtime environment file.
11
+
12
+ If `.cosmo/project.json` is absent, inspect before acting: offer `cosmo adopt` for an existing Astro site, use `cosmo init` only in an empty directory, and never overwrite unrelated files.
13
+
14
+ At each stage, read the contract and selected intelligence guidance, explain the immediate decision, create repository-owned artifacts, run the relevant checks, and wait for explicit user approval where required. Use `cosmo copy guide <page-id> .` before page writing. Keep facts, observations, inferences, and unknowns distinct. Explore at least three genuinely different visual directions; Claude Design is optional, and any capable design authority may satisfy the same repository-owned design contract.
15
+
16
+ Advance generation one state at a time. After two unsuccessful repair cycles, leave the page for human review. Require the exact release to report READY before production deployment.
17
+
18
+ When switching tools, create a durable handoff with `cosmo handoff create . --from <current-agent> --to <next-agent> --note "<summary and open decisions>"`. The next agent must continue from repository state.
@@ -0,0 +1,3 @@
1
+ # Cosmo
2
+
3
+ Start or resume Cosmo in this workspace. Read and follow `.agents/skills/cosmo/SKILL.md`, classify the project safely, recover any existing `.cosmo` state and `HANDOFF.md`, then guide the user through the exact next decision without requiring them to know command-line instructions.
@@ -50,6 +50,13 @@
50
50
  "path": ".cosmo/evidence.json",
51
51
  "kind": "json",
52
52
  "requiredKeys": ["version", "entityId", "claims", "proofs"]
53
+ },
54
+ {
55
+ "path": ".cosmo/copy/strategy.json",
56
+ "kind": "json",
57
+ "requiredKeys": ["version", "approved", "audience", "positioning", "competitiveTransition", "voice", "governance"],
58
+ "equals": { "approved": true },
59
+ "nonEmptyKeys": ["audience.primary", "audience.startingBelief", "audience.desiredBelief", "positioning.meaningfulBenefit", "positioning.differentiation", "governance.owner"]
53
60
  }
54
61
  ]
55
62
  },
@@ -104,7 +111,7 @@
104
111
  "id": "generate",
105
112
  "type": "core",
106
113
  "title": "Structured page generation",
107
- "instructions": "Move every page through briefed, sourced, outlined, drafted, edited, verified, and done gates. Keep page workspaces auditable, limit automated repairs to two cycles, and escalate unresolved work to a human.",
114
+ "instructions": "Create and approve a flexible Copy Studio brief for every page, then move each page through briefed, sourced, outlined, drafted, edited, verified, and done gates. Use the staged writing guide, keep page workspaces auditable, limit automated repairs to two cycles, and escalate unresolved work to a human.",
108
115
  "approval": false,
109
116
  "expects": [
110
117
  {
@@ -119,9 +126,15 @@
119
126
  "id": "qa",
120
127
  "type": "core",
121
128
  "title": "Production QA",
122
- "instructions": "Run semantic content, production-build, and rendered-browser checks. Remediate blocking findings without relaxing policy or inventing proof, then submit all passing reports for approval.",
129
+ "instructions": "Run Copy Studio, semantic content, production-build, and rendered-browser checks. Remediate blocking findings without relaxing policy or inventing proof, then submit all passing reports for approval.",
123
130
  "approval": true,
124
131
  "expects": [
132
+ {
133
+ "path": ".cosmo/reports/copy-check.json",
134
+ "kind": "json",
135
+ "requiredKeys": ["passed", "summary.pages", "summary.blocking", "summary.warnings"],
136
+ "equals": { "passed": true }
137
+ },
125
138
  {
126
139
  "path": ".cosmo/reports/content-check.json",
127
140
  "kind": "json",
@@ -1,22 +1,28 @@
1
- # Codex Project Guide
1
+ # Cosmo Project Guide
2
2
 
3
- This is a Cosmo-managed Astro project, commonly created in Claude and edited later in Codex. The repository—not prior chat history—is the source of truth.
3
+ This is a Cosmo-managed Astro project. It may be created or edited in Claude, Codex, Google Antigravity, another capable coding agent, or by a person. The repository—not previous chat history—is the source of truth.
4
+
5
+ When the user says `cosmo`, asks to start, continue, review, or release the site, follow `.agents/skills/cosmo/SKILL.md`. Do not require the user to know command-line instructions.
4
6
 
5
7
  Before editing:
6
8
 
7
9
  1. Read `HANDOFF.md` when present.
8
- 2. Run `cosmo doctor .`, `cosmo status .`, `cosmo workflow resume .`, `cosmo plan check .`, and `cosmo generate status .` when their state files exist.
9
- 3. Read `.cosmo/brand/discovery.json`, `BRAND-BRIEF.md`, `.cosmo/brand/entity-canon.json`, `.cosmo/brand/voice-profile.json`, `.cosmo/evidence.json`, `.cosmo/intelligence/selection.json`, every selected pack manifest and artifact, the relevant page brief, sources, outline, and editorial report, `DESIGN-DIRECTION.md`, `src/styles/tokens.css`, and the relevant typed content entries.
10
+ 2. Run `cosmo doctor .` and `cosmo status . --json`. Resume the active workflow and generation state when present.
11
+ 3. Read the project, brand, evidence, copy, intelligence, design, plan, page-work, QA, release, and deployment artifacts relevant to the active stage.
10
12
  4. Run `cosmo intelligence guide <stage> .` before selected-pack work. The first-party capability library is self-contained; do not depend on Lyra or Sonic files being present.
11
- 5. Preserve approved signature design elements unless the requested change explicitly revises the design direction.
13
+ 5. Preserve approved evidence, positioning, copy, and signature design elements unless the requested change explicitly revises them.
14
+
15
+ Never bypass workflow approvals, manufacture completion, invent business facts or evidence, fabricate reader psychology, imitate a living writer, or alter identity, intent, link, claim, and proof ids to evade a gate. Run `cosmo copy guide <page-id> .` before material copy work. Components should remain shared and semantic, but page compositions do not need to follow a Cosmo house style.
12
16
 
13
- Do not bypass workflow approvals, edit generated progress to manufacture completion, convert unsupported claims into plausible prose, invent demand, or alter identity, intent, link, claim, and proof ids to evade a gate. Components should remain shared and semantic; create a new component only for a genuinely new visual or behavioral pattern.
17
+ Claude Design is an optional creative authority, not a runtime requirement. When it is unavailable, use another capable design process while satisfying the same repository-owned exploration, responsive, accessibility, token, component, and design-handoff contracts.
14
18
 
15
19
  Verify changes in proportion to their scope. For a production handoff, run:
16
20
 
17
21
  ```bash
18
22
  npm run build
23
+ cosmo integrity check .
19
24
  cosmo check . --no-build
25
+ cosmo copy check .
20
26
  cosmo content check .
21
27
  cosmo intelligence check .
22
28
  cosmo browser check . --no-build