@vibecompass/vibecompass 0.5.0 → 0.6.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/CHANGELOG.md ADDED
@@ -0,0 +1,13 @@
1
+ # Changelog
2
+
3
+ ## 0.6.0 - 2026-05-25
4
+
5
+ - Bump docs-review to `VibeCompass Docs Review Prompt v2`.
6
+ - Add a staged docs-review workflow: evidence inventory, coverage plan, bounded doc generation, and apply/verify.
7
+ - Add retrieval-oriented metadata expectations so generated architecture docs are useful future context without requiring broad token-heavy loads.
8
+ - Add soft `oversized_architecture_doc` warnings for accepted architecture docs over the 12000-byte budget.
9
+ - Include package-owned workflow registry files in the npm tarball.
10
+
11
+ ## 0.5.0
12
+
13
+ - Previous published release.
package/README.md CHANGED
@@ -31,6 +31,7 @@ Shipped today:
31
31
  - `vibecompass docs-review --submit-hosted` — submit the review request to the hosted app and poll for proposal/artifact output
32
32
  - `vibecompass docs-review --run-local --provider anthropic` — local provider adapter that saves review output locally
33
33
  - `vibecompass docs-review --apply-output` — apply accepted architecture-doc blocks into canonical `architecture/` docs
34
+ - docs-review prompt v2 with staged evidence inventory, coverage planning, bounded doc generation, retrieval metadata, and soft oversized-doc warnings
34
35
  - strict docs-review output validation for architecture-doc fences, duplicate paths, and required frontmatter
35
36
  - `vibecompass docs-review --complete` — mark the review accepted after the docs land
36
37
  - hosted sync commands: `push`, `pull-preview`, `pull-export`, and `apply-export`
@@ -69,6 +70,15 @@ command is intentionally unscoped: `vibecompass`.
69
70
  npm install @vibecompass/vibecompass
70
71
  ```
71
72
 
73
+ ## Latest release
74
+
75
+ `0.6.0` upgrades docs-review to `VibeCompass Docs Review Prompt v2`.
76
+ The generated review prompt now guides the LLM through evidence inventory,
77
+ coverage planning, bounded architecture-doc generation, and apply/verify.
78
+ Accepted architecture docs over the 12000-byte soft budget are still applied,
79
+ but surface an `oversized_architecture_doc` warning so users can compact them
80
+ before future LLM sessions load that context.
81
+
72
82
  ## Quickstart
73
83
 
74
84
  Most users should start with the guided bootstrap:
@@ -194,9 +204,9 @@ remind you with a non-blocking warning if no completed review exists.
194
204
 
195
205
  What happens:
196
206
 
197
- 1. The CLI asks which LLM you'll use, then prints a versioned prompt template with fixed review criteria.
207
+ 1. The CLI asks which LLM you'll use, then prints a versioned staged review prompt with fixed review criteria.
198
208
  2. You paste that prompt into your AI tool (Claude Code, Codex, Cursor, etc.).
199
- 3. The AI reads your repo and writes architecture docs under
209
+ 3. The AI inventories project memory and source evidence, proposes a coverage plan, then writes only accepted architecture docs under
200
210
  `architecture/<domain>/<feature>/<component>.md`.
201
211
  4. Run `vibecompass docs-review --apply-output` after accepting fenced
202
212
  architecture-doc blocks, or `--complete` if accepted docs were written
@@ -205,8 +215,11 @@ What happens:
205
215
  The guided prompt is deterministic apart from project-specific fields
206
216
  (`project`, `mode`, `root`, provider, and model). It uses the same structure
207
217
  VibeCompass dogfoods: read project memory first, inspect source evidence,
208
- write component docs with review metadata, preserve the starter overview, and
209
- emit accepted docs as `vibecompass-architecture-doc` blocks.
218
+ build a coverage plan, write retrieval-oriented component docs with review
219
+ metadata, preserve the starter overview, and emit accepted docs as
220
+ `vibecompass-architecture-doc` blocks. The prompt includes a soft 12000-byte
221
+ budget per generated architecture doc so future LLM sessions can load targeted
222
+ context without pulling oversized narrative files by default.
210
223
 
211
224
  Plain `--guided` never calls an AI itself. You stay in control of which
212
225
  provider runs the review and what gets saved. Use `--run-local --provider
@@ -694,6 +707,11 @@ matches hosted docs-review proposal behavior. If one accepted output contains
694
707
  multiple blocks for the same architecture path, local apply fails rather than
695
708
  silently overwriting earlier accepted content.
696
709
 
710
+ Accepted architecture docs over the soft 12000-byte size budget are applied
711
+ with an `oversized_architecture_doc` warning instead of being rejected. Treat
712
+ that warning as a prompt to compact the doc unless the extra detail is needed
713
+ for future retrieval.
714
+
697
715
  `vibecompass docs-review --complete` updates the marker in
698
716
  `state/docs-review.json` to `status: "completed"` once the docs have
699
717
  landed, preserving the recorded `llm` / `model` so future sessions know
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vibecompass/vibecompass",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Local-first project-memory core for VibeCompass",
5
5
  "type": "module",
6
6
  "bin": {
@@ -11,8 +11,10 @@
11
11
  ".": "./src/index.js"
12
12
  },
13
13
  "files": [
14
+ "CHANGELOG.md",
14
15
  "src/*.js",
15
- "src/generators/**/*.js"
16
+ "src/generators/**/*.js",
17
+ "src/workflows/**/*.js"
16
18
  ],
17
19
  "scripts": {
18
20
  "test": "node --test src/tests/*.test.js",
@@ -5,6 +5,9 @@ import { parseFrontmatter } from './frontmatter.js';
5
5
  import { writeStateManifest } from './manifest.js';
6
6
  import { parseSimpleYaml } from './simple-yaml.js';
7
7
 
8
+ const DOCS_REVIEW_PROMPT_VERSION = 'VibeCompass Docs Review Prompt v2';
9
+ const ARCHITECTURE_DOC_SOFT_SIZE_LIMIT_BYTES = 12000;
10
+
8
11
  export async function preflightDocsReview(options = {}, environment = {}) {
9
12
  validateDocsReviewMode(options);
10
13
  const cwd = options.cwd ? path.resolve(options.cwd) : process.cwd();
@@ -195,6 +198,7 @@ async function applyDocsReviewOutput(options) {
195
198
  }
196
199
 
197
200
  validateArchitectureDocBlocks(blocks);
201
+ const warnings = createArchitectureDocSizeWarnings(blocks);
198
202
 
199
203
  const applied = [];
200
204
  for (const block of blocks) {
@@ -215,6 +219,7 @@ async function applyDocsReviewOutput(options) {
215
219
  applied: {
216
220
  output_path: outputPath,
217
221
  architecture_docs: applied,
222
+ ...(warnings.length > 0 ? { warnings } : {}),
218
223
  applied_at: new Date().toISOString(),
219
224
  },
220
225
  completed_at: new Date().toISOString(),
@@ -232,7 +237,7 @@ async function applyDocsReviewOutput(options) {
232
237
  hosted: current.hosted ?? null,
233
238
  applied: marker.applied,
234
239
  reviewPrompt: null,
235
- warnings: [],
240
+ warnings,
236
241
  message: `Applied ${applied.length} accepted architecture doc${applied.length === 1 ? '' : 's'} and completed the docs-review marker.`,
237
242
  };
238
243
  }
@@ -679,6 +684,19 @@ function validateArchitectureDocBlock(block) {
679
684
  }
680
685
  }
681
686
 
687
+ function createArchitectureDocSizeWarnings(blocks) {
688
+ return blocks
689
+ .map((block) => {
690
+ const byteLength = Buffer.byteLength(ensureTrailingNewline(block.content), 'utf8');
691
+ if (byteLength <= ARCHITECTURE_DOC_SOFT_SIZE_LIMIT_BYTES) {
692
+ return null;
693
+ }
694
+
695
+ return `oversized_architecture_doc: ${block.path} is ${byteLength} bytes; soft budget is ${ARCHITECTURE_DOC_SOFT_SIZE_LIMIT_BYTES} bytes. Consider compacting the doc to preserve future LLM context budget.`;
696
+ })
697
+ .filter(Boolean);
698
+ }
699
+
682
700
  async function submitHostedDocsReview(options) {
683
701
  if (options.runtime.provider !== 'hosted') {
684
702
  throw new Error('docs-review --submit-hosted requires a hosted sync binding in project.yaml.');
@@ -1081,9 +1099,9 @@ function renderDocsReviewMessage(options) {
1081
1099
 
1082
1100
  function renderReviewPrompt(options) {
1083
1101
  return [
1084
- '# VibeCompass Docs Review Prompt v1',
1102
+ `# ${DOCS_REVIEW_PROMPT_VERSION}`,
1085
1103
  '',
1086
- 'Run a comprehensive VibeCompass architecture documentation review for the project-memory root below. Follow this prompt exactly; do not invent a different document structure.',
1104
+ 'Run a staged VibeCompass architecture documentation review for the project-memory root below. Follow this prompt exactly; do not invent a different document structure.',
1087
1105
  '',
1088
1106
  '## Review Context',
1089
1107
  `- Project memory root: ${options.rootDir}`,
@@ -1096,13 +1114,35 @@ function renderReviewPrompt(options) {
1096
1114
  '1. Read `project.yaml`.',
1097
1115
  '2. Read `context.md` if present.',
1098
1116
  '3. Read all canonical files under `architecture/`, `decisions/`, and finalized `sessions/`.',
1099
- '4. Inspect the declared repositories and cite concrete source, config, and test files before making implementation claims.',
1117
+ '4. Inspect declared repositories before making implementation claims.',
1118
+ '',
1119
+ '## Staged Review Protocol',
1120
+ 'Stage 1 — Evidence inventory:',
1121
+ '- Build a compact repo inventory from file paths, manifests/config files, route/job/test directories, and existing architecture frontmatter before reading large file bodies.',
1122
+ '- Identify candidate domains, features, components, and ownership boundaries with concrete `repo:path` evidence.',
1123
+ '- Do not fetch or summarize broad source bodies until the coverage plan says a file is needed.',
1124
+ '',
1125
+ 'Stage 2 — Coverage plan:',
1126
+ '- Propose the smallest useful architecture-doc set that will let future agents understand the project and retrieve targeted context.',
1127
+ '- Prioritize entry points, data ownership, external integrations, jobs/async boundaries, auth/security boundaries, and test surfaces.',
1128
+ '- Mark each proposed doc as `comprehensive`, `partial`, or `initial`, with the reason and blindspots.',
1129
+ '- Ask for user acceptance before emitting fenced architecture-doc blocks.',
1130
+ '',
1131
+ 'Stage 3 — Bounded doc generation:',
1132
+ '- Generate only accepted docs, one complete fenced block per architecture path.',
1133
+ '- Keep docs concise and retrieval-oriented: explain contracts, flows, invariants, and ownership; do not rewrite source code or produce file-by-file walkthroughs.',
1134
+ `- Soft size budget: keep each generated architecture doc under ${ARCHITECTURE_DOC_SOFT_SIZE_LIMIT_BYTES} bytes unless the extra detail is necessary and called out in Blindspots or Retrieval guidance.`,
1135
+ '- Include only the most important involved files; prefer representative entry points and owned contracts over exhaustive file lists.',
1136
+ '',
1137
+ 'Stage 4 — Apply and verify:',
1138
+ '- After accepted blocks are written to `state/docs-review-output.md`, run `vibecompass docs-review --apply-output`.',
1139
+ '- Surface any parser warnings, especially oversized docs, so the user can decide whether to compact or accept the output.',
1100
1140
  '',
1101
1141
  '## Architecture Doc Contract',
1102
1142
  'When creating or updating architecture docs, use the existing VibeCompass structure:',
1103
1143
  '- path: `architecture/<domain-slug>/<feature-slug>/<component-slug>.md` for component docs',
1104
1144
  '- frontmatter fields: `domain`, `feature`, `component`, `status`, plus `repo` or `repos` when implementation-scoped',
1105
- '- body sections: `## Description`, `## Review metadata`, `## Details`, `## Next steps`, `## Involved files`',
1145
+ '- body sections: `## Description`, `## Review metadata`, `## Details`, `## Retrieval guidance`, `## Next steps`, `## Involved files`',
1106
1146
  '',
1107
1147
  'Use this exact Review metadata sub-header in every generated architecture doc:',
1108
1148
  '',
@@ -1113,6 +1153,8 @@ function renderReviewPrompt(options) {
1113
1153
  '- Confidence: high | medium | low',
1114
1154
  '- Coverage: comprehensive | partial | initial',
1115
1155
  '- Evidence: repo:path references inspected before making implementation claims',
1156
+ '- Retrieval scope: when future agents should load this doc',
1157
+ `- Token posture: compact unless the doc intentionally exceeds ${ARCHITECTURE_DOC_SOFT_SIZE_LIMIT_BYTES} bytes`,
1116
1158
  '- Blindspots: explicit list, or "None identified" only when evidence is comprehensive',
1117
1159
  '',
1118
1160
  '## Review Rules',
@@ -1124,12 +1166,15 @@ function renderReviewPrompt(options) {
1124
1166
  '6. Put uncertainty in `Blindspots`; do not fill gaps with guesses.',
1125
1167
  '7. Do not append real `D-NNN` decisions without explicit user acceptance. Propose candidate decisions separately.',
1126
1168
  '8. Do not edit `decisions/INDEX.md` directly unless a canonical decision file was explicitly accepted and appended.',
1169
+ '9. Optimize for future retrieval: project-level docs stay compact; component docs carry focused context for a specific area.',
1127
1170
  '',
1128
1171
  '## Output Contract',
1129
1172
  'First provide a concise findings summary with:',
1130
1173
  '- mapped areas',
1131
1174
  '- gaps/blindspots',
1132
- '- proposed architecture docs',
1175
+ '- evidence inventory summary',
1176
+ '- coverage plan and proposed architecture docs',
1177
+ '- token-budget risks or oversized-doc candidates',
1133
1178
  '- proposed decisions, if any',
1134
1179
  '',
1135
1180
  'Then, for each architecture doc the user accepts, output one fenced block exactly like this:',
@@ -0,0 +1,138 @@
1
+ export const WORKFLOW_REGISTRY = [
2
+ {
3
+ id: 'session-lifecycle',
4
+ title: 'Session lifecycle',
5
+ detailPath: 'context.md',
6
+ summary: 'Builder/reviewer lane lifecycle, handoffs, planning mode, and close-out.',
7
+ promptCommands: [
8
+ { trigger: 'start session', summary: 'builder role trigger' },
9
+ { trigger: 'join as reviewer', summary: 'reviewer role trigger' },
10
+ { trigger: 'planning mode', summary: 'optional prompt-level mode for scoping work before implementation' },
11
+ { trigger: 'review handoff', summary: 'reviewer reads the selected lane handoff and appends findings' },
12
+ { trigger: 'address review', summary: 'builder processes reviewer feedback from the selected lane scratch files' },
13
+ { trigger: 'close session', summary: 'builder runs the close-out checklist and ends with `vibecompass close-session --session <lane-id>`; `end session` and `vibecompass end-session` are accepted aliases' },
14
+ ],
15
+ },
16
+ {
17
+ id: 'docs-review',
18
+ title: 'Docs review',
19
+ detailPath: 'workflows/docs-review.md',
20
+ summary: 'Generate evidence-backed architecture docs from the user\'s preferred AI session.',
21
+ promptCommands: [
22
+ { trigger: 'docs review', summary: 'agent-led architecture documentation review using the preferred LLM prompt box' },
23
+ ],
24
+ generatedFileKind: 'workflow-docs-review',
25
+ renderFile: renderDocsReviewWorkflow,
26
+ },
27
+ ];
28
+
29
+ export function getPromptCommands() {
30
+ return WORKFLOW_REGISTRY.flatMap((workflow) =>
31
+ workflow.promptCommands.map((command) => ({
32
+ ...command,
33
+ workflowId: workflow.id,
34
+ workflowTitle: workflow.title,
35
+ detailPath: workflow.detailPath,
36
+ })),
37
+ );
38
+ }
39
+
40
+ export function getWorkflowConflictScanPatterns() {
41
+ const patterns = new Set([
42
+ 'session',
43
+ 'handoff',
44
+ 'decisions',
45
+ 'wip.md',
46
+ 'builder',
47
+ 'reviewer',
48
+ ]);
49
+
50
+ for (const command of getPromptCommands()) {
51
+ const normalizedTrigger = command.trigger.toLowerCase();
52
+ patterns.add(normalizedTrigger);
53
+ patterns.add(slugifyPromptTrigger(normalizedTrigger));
54
+ }
55
+
56
+ return Array.from(patterns);
57
+ }
58
+
59
+ export function getGeneratedWorkflowFiles(options = {}) {
60
+ const rootRelativePath = options.rootRelativePath ?? '.';
61
+ return WORKFLOW_REGISTRY
62
+ .filter((workflow) => typeof workflow.renderFile === 'function')
63
+ .map((workflow) => ({
64
+ kind: workflow.generatedFileKind,
65
+ relativePath: workflow.detailPath,
66
+ content: workflow.renderFile({
67
+ rootRelativePath,
68
+ workflow,
69
+ }),
70
+ }));
71
+ }
72
+
73
+ export function renderPromptCommandLines(options = {}) {
74
+ const rootRelativePath = options.rootRelativePath ?? '.';
75
+ return getPromptCommands().map((command) => {
76
+ const detailPath = command.detailPath
77
+ ? ` Read \`${joinRootRelative(rootRelativePath, command.detailPath)}\` for the full workflow.`
78
+ : '';
79
+ return `- \`${command.trigger}\` — ${command.summary}.${detailPath}`;
80
+ });
81
+ }
82
+
83
+ function renderDocsReviewWorkflow(options = {}) {
84
+ const rootRelativePath = options.rootRelativePath ?? '.';
85
+ const projectYamlPath = joinRootRelative(rootRelativePath, 'project.yaml');
86
+ const contextPath = joinRootRelative(rootRelativePath, 'context.md');
87
+ const architecturePath = joinRootRelative(rootRelativePath, 'architecture/');
88
+ const decisionsPath = joinRootRelative(rootRelativePath, 'decisions/');
89
+ const sessionsPath = joinRootRelative(rootRelativePath, 'sessions/');
90
+ const outputPath = joinRootRelative(rootRelativePath, 'state/docs-review-output.md');
91
+
92
+ return `# VibeCompass Workflow — docs review
93
+
94
+ Generated by VibeCompass. This file is a package-owned workflow guide and may be refreshed by \`vibecompass refresh-workflow --apply\`.
95
+
96
+ ## Prompt trigger
97
+
98
+ When the user says \`docs review\`, run this workflow inside the current Claude Code, Codex, Cursor, or Copilot session. The npm package owns state markers and apply mechanics; the AI session owns repository inspection and writing accepted architecture docs.
99
+
100
+ ## Goal
101
+
102
+ Turn starter project memory into evidence-backed architecture docs under \`architecture/<domain>/<feature>/<component>.md\`.
103
+
104
+ ## Steps
105
+
106
+ 1. Read \`${projectYamlPath}\`, \`${contextPath}\`, existing \`${architecturePath}\`, \`${decisionsPath}\`, and finalized \`${sessionsPath}\` notes.
107
+ 2. Inspect the declared source repos in stages:
108
+ - inventory paths, manifests, configs, route/job/test directories, and existing architecture frontmatter first
109
+ - produce a coverage plan before reading broad source bodies
110
+ - read targeted source files only when the coverage plan needs evidence
111
+ 3. Run \`vibecompass docs-review --guided --llm <tool-name> --model <model-name>\` to record the review marker and print the canonical docs-review contract. Use the current AI tool name and model when known.
112
+ 4. Present the evidence inventory, coverage plan, proposed architecture docs, blindspots, and token-budget risks before generating accepted docs.
113
+ 5. Draft only architecture docs the user accepts. Accepted docs must be fenced exactly as \`vibecompass-architecture-doc path=architecture/domain/feature/component.md\` blocks and must include required frontmatter: \`domain\`, \`feature\`, \`component\`, and \`status\`.
114
+ 6. Keep each generated architecture doc focused and retrieval-oriented. Soft budget: under 12000 bytes per doc unless the extra detail is necessary and called out in review metadata or retrieval guidance.
115
+ 7. Write the accepted fenced blocks to \`${outputPath}\`.
116
+ 8. Run \`vibecompass docs-review --apply-output\` to validate and apply the accepted blocks. If accepted docs were written manually outside the output file, run \`vibecompass docs-review --complete\` after confirming the marker should be completed.
117
+ 9. Run \`vibecompass status\` to confirm the docs-review marker is complete. Report the applied architecture paths, any parser warnings such as oversized docs, and any blindspots documented in the accepted docs-review output.
118
+
119
+ ## Rules
120
+
121
+ - Do not duplicate the full canonical review prompt in this file. The package command prints that contract from its current implementation.
122
+ - Follow the canonical review prompt for evidence, blindspot, and decision-recommendation constraints.
123
+ - Treat the package-owned prompt as the source of truth. Tool-specific skills may wrap this workflow, but should not define a divergent docs-review protocol.
124
+ - Do not edit generated agent files directly. Update VibeCompass project memory or rerun package commands instead.
125
+ `;
126
+ }
127
+
128
+ function slugifyPromptTrigger(trigger) {
129
+ return trigger.trim().replace(/\s+/g, '-');
130
+ }
131
+
132
+ function joinRootRelative(rootRelativePath, relativePath) {
133
+ if (!rootRelativePath || rootRelativePath === '.') {
134
+ return relativePath;
135
+ }
136
+
137
+ return `${rootRelativePath.replace(/\/$/, '')}/${relativePath}`;
138
+ }