@sandrinio/vdoc 3.7.1 → 3.9.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 (63) hide show
  1. package/README.md +68 -12
  2. package/bin/vdoc.mjs +10 -0
  3. package/package.json +1 -1
  4. package/skills/agents/references/audit-workflow.md +41 -10
  5. package/skills/agents/references/create-workflow.md +77 -0
  6. package/skills/agents/references/discovery-protocol.md +211 -0
  7. package/skills/agents/references/doc-template.md +102 -32
  8. package/skills/agents/references/init-workflow.md +135 -27
  9. package/skills/agents/references/manifest-schema.json +8 -1
  10. package/skills/claude/references/audit-workflow.md +39 -10
  11. package/skills/claude/references/create-workflow.md +41 -18
  12. package/skills/claude/references/discovery-protocol.md +211 -0
  13. package/skills/claude/references/doc-template.md +102 -32
  14. package/skills/claude/references/init-workflow.md +131 -23
  15. package/skills/claude/references/manifest-schema.json +8 -1
  16. package/skills/cline/references/audit-workflow.md +41 -10
  17. package/skills/cline/references/create-workflow.md +77 -0
  18. package/skills/cline/references/discovery-protocol.md +211 -0
  19. package/skills/cline/references/doc-template.md +102 -32
  20. package/skills/cline/references/init-workflow.md +135 -27
  21. package/skills/cline/references/manifest-schema.json +8 -1
  22. package/skills/continue/references/audit-workflow.md +41 -10
  23. package/skills/continue/references/create-workflow.md +77 -0
  24. package/skills/continue/references/discovery-protocol.md +211 -0
  25. package/skills/continue/references/doc-template.md +102 -32
  26. package/skills/continue/references/init-workflow.md +135 -27
  27. package/skills/continue/references/manifest-schema.json +8 -1
  28. package/skills/cursor/references/audit-workflow.md +41 -10
  29. package/skills/cursor/references/create-workflow.md +77 -0
  30. package/skills/cursor/references/discovery-protocol.md +211 -0
  31. package/skills/cursor/references/doc-template.md +102 -32
  32. package/skills/cursor/references/init-workflow.md +135 -27
  33. package/skills/cursor/references/manifest-schema.json +8 -1
  34. package/skills/gemini/references/audit-workflow.md +41 -10
  35. package/skills/gemini/references/create-workflow.md +77 -0
  36. package/skills/gemini/references/discovery-protocol.md +211 -0
  37. package/skills/gemini/references/doc-template.md +102 -32
  38. package/skills/gemini/references/init-workflow.md +135 -27
  39. package/skills/gemini/references/manifest-schema.json +8 -1
  40. package/skills/jetbrains-ai/references/audit-workflow.md +41 -10
  41. package/skills/jetbrains-ai/references/create-workflow.md +77 -0
  42. package/skills/jetbrains-ai/references/discovery-protocol.md +211 -0
  43. package/skills/jetbrains-ai/references/doc-template.md +102 -32
  44. package/skills/jetbrains-ai/references/init-workflow.md +135 -27
  45. package/skills/jetbrains-ai/references/manifest-schema.json +8 -1
  46. package/skills/junie/references/audit-workflow.md +41 -10
  47. package/skills/junie/references/create-workflow.md +77 -0
  48. package/skills/junie/references/discovery-protocol.md +211 -0
  49. package/skills/junie/references/doc-template.md +102 -32
  50. package/skills/junie/references/init-workflow.md +135 -27
  51. package/skills/junie/references/manifest-schema.json +8 -1
  52. package/skills/vscode/references/audit-workflow.md +41 -10
  53. package/skills/vscode/references/create-workflow.md +77 -0
  54. package/skills/vscode/references/discovery-protocol.md +211 -0
  55. package/skills/vscode/references/doc-template.md +102 -32
  56. package/skills/vscode/references/init-workflow.md +133 -25
  57. package/skills/vscode/references/manifest-schema.json +8 -1
  58. package/skills/windsurf/resources/audit-workflow.md +41 -10
  59. package/skills/windsurf/resources/create-workflow.md +77 -0
  60. package/skills/windsurf/resources/discovery-protocol.md +211 -0
  61. package/skills/windsurf/resources/doc-template.md +102 -32
  62. package/skills/windsurf/resources/init-workflow.md +137 -29
  63. package/skills/windsurf/resources/manifest-schema.json +8 -1
@@ -1,92 +1,162 @@
1
+ ---
2
+ title: "{Feature Title}"
3
+ description: "{One-line description of what this covers}"
4
+ tags: ["{domain}", "{capability}"]
5
+ version: 1
6
+ keyFiles: ["{src/path/main-file.ts}"]
7
+ relatedDocs: []
8
+ lastUpdated: "{YYYY-MM-DD}"
9
+ ---
10
+
1
11
  # {Feature Title}
2
12
 
3
- > {One-line description of what this covers}
13
+ > {One-line description same as frontmatter description}
14
+
15
+ <!-- TEMPLATE GUIDANCE
16
+ Sections marked [CORE] — always include.
17
+ Sections marked [CONDITIONAL] — include only when relevant, omit entirely otherwise.
18
+ Do NOT leave empty sections or write "N/A".
19
+ -->
4
20
 
5
21
  ---
6
22
 
7
23
  ## Overview
24
+ <!-- [CORE] -->
25
+
26
+ {What it does, why it exists, and who it's for. Lead with the user value — what problem does this solve? Then explain how it fits in the broader system. A PM should be able to read this section alone and understand the feature.}
27
+
28
+ ---
29
+
30
+ ## Business Rules
31
+ <!-- [CORE] -->
32
+
33
+ {Plain-language rules that govern this feature's behavior. No code, no implementation details — just the "what" and "why" a PM or stakeholder needs to know.}
34
+
35
+ - {Rule}: {Description}
8
36
 
9
- {What it does and why it exists. Start with the value proposition — what problem does this solve for the user? Then explain how it fits in the system.}
37
+ <!-- Examples:
38
+ - **Trial limit**: Free users get 3 projects. Creating a 4th triggers the upgrade prompt.
39
+ - **Auto-archive**: Inactive workspaces are archived after 90 days. Owners get email warnings at 60 and 80 days.
40
+ - **Rate limiting**: API consumers are capped at 100 req/min per API key. Exceeding returns 429.
41
+ -->
10
42
 
11
43
  ---
12
44
 
13
45
  ## User Workflows
46
+ <!-- [CONDITIONAL: include for user-facing features] -->
14
47
 
15
- {Step-by-step journeys for the 1-3 primary user actions. For each workflow:}
48
+ {Step-by-step journeys for the 1-3 primary user actions.}
16
49
 
17
50
  1. **{Workflow Name}**
18
- - **User action:** {What the user does}
19
- - **System response:** {What the system does}
20
- - **Result:** {What the user sees}
51
+ - **Trigger:** {What the user does}
52
+ - **Steps:** {What happens keep it sequential}
53
+ - **Result:** {What the user sees or gets}
21
54
 
22
55
  ---
23
56
 
24
57
  ## How It Works
58
+ <!-- [CORE] -->
25
59
 
26
- {Trace at least one complete request from user action to final effect. Show the full path through every service, database call, and external system involved. Don't skip intermediaries.}
60
+ {Trace at least one complete request from trigger to final effect. Show the full path through every service, database call, and external system. Don't skip intermediaries.}
27
61
 
28
62
  {Use a sequence diagram for the primary flow — show all actors. Use flowcharts for branching logic only. Max 7-9 nodes per diagram, split into multiple if larger.}
29
63
 
30
64
  ---
31
65
 
32
- ## Data Model
66
+ ## Key Files
33
67
 
34
- {Primary tables this feature owns. Include actual column names, types, and purpose — not just entity names.}
68
+ <!-- [CORE] -->
35
69
 
36
- | Column | Type | Description |
37
- |--------|------|-------------|
38
- | `column_name` | `type` | What it stores |
70
+ | File | Type | Purpose |
71
+ |------|------|---------|
72
+ | `src/path/file.ts` | Source | {What this file does} |
73
+ | `src/path/file.test.ts` | Test | {What it validates} |
74
+ | `.env` / `config.ts` | Config | {What it controls} |
39
75
 
40
- {Mermaid ER diagram for relationships between tables.}
76
+ <!-- Type = Source, Test, Config, Migration, Script, Route, Hook, Store, Template, etc. -->
41
77
 
42
78
  ---
43
79
 
44
- ## Key Files
80
+ ## Testing
81
+ <!-- [CORE] -->
45
82
 
46
- | File | Purpose |
47
- |------|---------|
48
- | `src/path/file.ts` | What this file does |
83
+ **Run:** `{test command e.g. npm test -- --grep "feature-name"}`
49
84
 
50
- ---
85
+ | What | Location | Notes |
86
+ |------|----------|-------|
87
+ | Unit tests | `{path}` | {What's covered} |
88
+ | Integration tests | `{path}` | {What's covered} |
89
+ | E2E tests | `{path}` | {What's covered} |
51
90
 
52
- ## Dependencies & Integrations
91
+ **Coverage gaps:** {What is NOT tested and why — honest assessment. "None" if fully covered.}
53
92
 
54
- {External services, internal features, packages this relies on.}
93
+ **Manual testing:** {Steps for anything that requires manual verification, or "Fully automated" if none.}
55
94
 
56
95
  ---
57
96
 
58
- ## Configuration
97
+ ## Common Tasks
98
+ <!-- [CONDITIONAL: include when feature has recurring modification patterns] -->
59
99
 
60
- | Variable | Purpose | Required |
61
- |----------|---------|----------|
62
- | `ENV_VAR` | What it controls | Yes/No |
100
+ {Cookbook-style recipes for the things developers actually do with this feature. Each recipe should be copy-paste actionable.}
101
+
102
+ ### {Task name e.g. "Add a new payment method"}
103
+ 1. {Step}
104
+ 2. {Step}
105
+ 3. {Step}
106
+
107
+ <!-- Keep recipes short (3-6 steps). If a task needs more, it's probably a workflow, not a recipe. -->
63
108
 
64
109
  ---
65
110
 
66
- ## Error Handling & Edge Cases
111
+ ## Data Model
112
+ <!-- [CONDITIONAL: include when feature owns database tables or persistent state] -->
67
113
 
68
- {Specific failure scenarios, not generic statements. For each:}
114
+ {Primary tables/collections this feature owns.}
69
115
 
70
- - **{Scenario}** {What triggers it}. User sees: {what}. System does: {recovery/logging}.
116
+ | Column | Type | Description |
117
+ |--------|------|-------------|
118
+ | `column_name` | `type` | What it stores |
119
+
120
+ {Mermaid ER diagram for relationships between tables.}
71
121
 
72
122
  ---
73
123
 
74
- ## Security
124
+ ## Dependencies & Integrations
125
+ <!-- [CONDITIONAL: include when feature depends on external services or other features] -->
75
126
 
76
- {Authentication and authorization patterns. Service roles, secrets, access control. What an attacker could exploit if this feature were misconfigured.}
127
+ | Dependency | Type | What breaks if it's down |
128
+ |------------|------|--------------------------|
129
+ | `{service/package/feature}` | External / Internal | {Impact} |
130
+
131
+ ---
132
+
133
+ ## Error Handling & Edge Cases
134
+ <!-- [CONDITIONAL: include when feature has non-obvious failure modes] -->
135
+
136
+ - **{Scenario}** — {What triggers it}. User sees: {what}. System does: {recovery/logging}.
77
137
 
78
138
  ---
79
139
 
80
140
  ## Constraints & Decisions
141
+ <!-- [CORE] -->
81
142
 
82
- {Why it's built this way. What you CANNOT change without breaking things.}
143
+ {Why it's built this way. What you CANNOT change without breaking things. Include security considerations here — auth patterns, access control, secrets — when relevant.}
144
+
145
+ - **{Decision}**: {What was decided and why. What alternative was rejected.}
83
146
 
84
147
  ---
85
148
 
86
149
  ## Related Features
150
+ <!-- [CORE] -->
87
151
 
88
- {Cross-references to other docs by filename. Blast radius — what breaks if this changes.}
152
+ | Doc | Relationship | Blast radius |
153
+ |-----|-------------|--------------|
154
+ | `{filename.md}` | {depends on / depended by / shares data with} | {What breaks if this feature changes} |
89
155
 
90
156
  ---
91
157
 
92
- *Generated by vdoc v3.0.0 • Last updated: {timestamp}*
158
+ ## Change Log
159
+
160
+ | Date | Change | By |
161
+ |------|--------|-----|
162
+ | {YYYY-MM-DD} | Initial documentation | vdoc |
@@ -5,7 +5,7 @@
5
5
  Follow the two-phase exploration strategy in `references/exploration-strategies.md`:
6
6
 
7
7
  **Phase 1 — Fingerprint** (3-5 file reads max)
8
- Read package/config files and directory structure to identify the project's language, framework, and archetype. Also check for existing documentation (`vdocs/`, `docs/`, `product_documentation/`, substantial `*.md` files). If found, read them first — they're a head start. See the "Existing Documentation" section in `references/exploration-strategies.md`.
8
+ Read package/config files and directory structure using Read, Glob, and Grep to identify the project's language, framework, and archetype. Also check for existing documentation (`vdocs/`, `docs/`, `product_documentation/`, substantial `*.md` files). If found, read them first — they're a head start. See the "Existing Documentation" section in `references/exploration-strategies.md`.
9
9
 
10
10
  **Phase 2 — Targeted Exploration** (archetype-specific)
11
11
  Apply the matching archetype playbook from `references/exploration-strategies.md`. Read files in priority order using the glob patterns listed. Identify feature signals — each signal maps to a documentable feature. Combine multiple playbooks when the project doesn't fit a single archetype (see "Composing Archetypes" in the strategies file).
@@ -14,10 +14,19 @@ If no archetype matches, use the Fallback strategy and confirm with the user.
14
14
 
15
15
  Do not skim. Understand how the system actually works before proposing docs.
16
16
 
17
- **Important:** Use your built-in file-reading tools to explore. Do NOT create scanner scripts, shell scripts, or any tooling. vdoc is purely AI-driven no scripts, no build steps, no infrastructure.
17
+ **Phase 2b Behavior Discovery** (universalruns after archetype playbook)
18
+ Apply the 4-layer discovery protocol from `references/discovery-protocol.md`:
19
+ 1. **Capability Surface** — Map every entry point (routes, endpoints, commands, exports)
20
+ 2. **Data Flows** — For each capability, trace data from source to screen to mutation
21
+ 3. **Shared Behaviors** — Find cross-cutting concerns (auth, error handling, notifications, feature flags)
22
+ 4. **Integration Boundary** — Map every external touchpoint (outgoing API calls, incoming webhooks, background jobs, env vars)
23
+
24
+ This catches behaviors that file-structure exploration misses: background jobs, event-driven workflows, hidden integrations, cross-feature dependencies.
25
+
26
+ **Important:** Use your built-in tools (Read, Glob, Grep) to explore. Do NOT create scanner scripts, shell scripts, or any tooling. vdoc is purely AI-driven — no scripts, no build steps, no infrastructure.
18
27
 
19
28
  **Phase 3 — Write Exploration Log**
20
- After exploring, write `vdocs/_exploration_log.md` documenting what you found:
29
+ After exploring, write `vdocs/_planning/_exploration_log.md` documenting what you found:
21
30
 
22
31
  ```markdown
23
32
  # Exploration Log
@@ -42,6 +51,38 @@ After exploring, write `vdocs/_exploration_log.md` documenting what you found:
42
51
  | Prisma schema with 8 models | prisma/schema.prisma | DATA_MODEL_DOC.md |
43
52
  | ... | ... | ... |
44
53
 
54
+ ## Capability Surface
55
+ | Entry Point | Type | Proposed Doc |
56
+ |-------------|------|--------------|
57
+ | /api/auth/* | Auth routes (5 endpoints) | AUTHENTICATION_DOC.md |
58
+ | /dashboard | Page + 3 sub-routes | DASHBOARD_DOC.md |
59
+
60
+ ## Data Flows
61
+ | Feature | State Source | API Calls | Mutations |
62
+ |---------|-------------|-----------|----------|
63
+ | Dashboard | useDashboardStore | GET /api/stats | None (read-only) |
64
+
65
+ ## Shared Behaviors
66
+ | Behavior | Scope | Implementation |
67
+ |----------|-------|----------------|
68
+ | Auth | All /app/* routes | NextAuth middleware + useSession hook |
69
+
70
+ ## Integration Boundary
71
+ | Direction | System | Purpose | Env Var |
72
+ |-----------|--------|---------|--------|
73
+ | Outgoing | Stripe API | Payments | STRIPE_SECRET_KEY |
74
+ | Incoming | Stripe webhooks | Payment events | /api/webhooks/stripe |
75
+ | Background | Cron: cleanup-sessions | Expire old sessions | Vercel Cron |
76
+
77
+ ## Cross-Feature Dependencies
78
+ After identifying all feature signals, grep for imports/references between features to map which features consume each other's data, types, or APIs. This prevents missing secondary workflows during doc generation.
79
+
80
+ | Feature A | Feature B | Connection | Impact |
81
+ |-----------|-----------|------------|--------|
82
+ | Azure DevOps Integration | Google Sheets Export | Sheets exports work items fetched by Azure module | Azure doc must cover the export workflow |
83
+ | Auth (NextAuth) | All API routes | Every route uses auth middleware | Auth doc must list all protected routes |
84
+ | ... | ... | ... | ... |
85
+
45
86
  ## Ambiguities / Open Questions
46
87
  - Could not determine why Redis is in dependencies — no usage found. Ask user.
47
88
  - Payments folder exists but appears incomplete / WIP.
@@ -51,13 +92,19 @@ This log is your working memory. It feeds directly into Step 2 (Plan).
51
92
 
52
93
  ## Step 2 — Plan
53
94
 
54
- Write `vdocs/_DOCUMENTATION_PLAN.md` to disk AND present it to the user in the same step. The file must be persisted — do not just show it in chat.
95
+ Write `vdocs/_planning/_DOCUMENTATION_PLAN.md` to disk AND present it to the user in the same step. The file must be persisted — do not just show it in chat.
55
96
 
56
97
  Use this format:
57
98
 
58
99
  ```markdown
59
100
  # Documentation Plan
60
101
 
102
+ ## Fingerprint
103
+ - **Language(s):** e.g., TypeScript, Python
104
+ - **Framework(s):** e.g., Next.js 14, FastAPI
105
+ - **Archetype(s):** e.g., Full-stack Framework
106
+ - **Scope:** e.g., ~85 files, medium
107
+
61
108
  ## Proposed Documents
62
109
 
63
110
  1. **PROJECT_OVERVIEW_DOC.md** — Tech stack, architecture, project structure, dev setup
@@ -79,7 +126,7 @@ Wait for user approval before proceeding.
79
126
 
80
127
  ## Step 3 — Generate
81
128
 
82
- Read the template from `.agents/vdoc/doc-template.md` once before starting.
129
+ Read the template from [doc-template.md](./doc-template.md) once before starting.
83
130
 
84
131
  Then generate docs **one at a time, sequentially**. For each approved doc:
85
132
 
@@ -93,46 +140,107 @@ Do NOT attempt to generate multiple docs from memory. Each doc is a fresh cycle:
93
140
 
94
141
  **Writing rules:**
95
142
 
96
- - **Overview** must open with the value proposition what problem does this feature solve for the user? Not just "manages X" but "enables users to Y without Z."
97
- - **User Workflows** — describe 1-3 primary user journeys step by step: what the user does, what the system does, what the user sees. This grounds the doc in product reality.
143
+ - **YAML frontmatter** every doc MUST start with frontmatter: `title`, `description`, `tags`, `version` (start at 1), `keyFiles` (array of primary source file paths), `relatedDocs` (array of other doc filenames), `lastUpdated` (YYYY-MM-DD). This metadata is the machine-readable contract keep it in sync with the doc body.
144
+ - **CORE vs CONDITIONAL sections** — follow the `[CORE]` and `[CONDITIONAL]` markers in the template. Omit conditional sections entirely when not relevant. Do NOT leave empty sections or write "N/A".
145
+ - **Overview** must open with the value proposition — what problem does this feature solve for the user? Not just "manages X" but "enables users to Y without Z." A PM should understand the feature from this section alone.
146
+ - **Business Rules** — plain-language rules that govern behavior. No code. "Free users get 3 projects", "Sessions expire after 30 min of inactivity", "Rate limit: 100 req/min per API key." If you can't find explicit rules, derive them from the code and mark with `Inferred from code — verify with team`.
147
+ - **User Workflows** — describe 1-3 primary user journeys step by step: what the user does, what the system does, what the user sees. This grounds the doc in product reality. [CONDITIONAL: omit for non-user-facing features like background jobs]
98
148
  - **"How It Works" must use sequence diagrams** for the primary flow — show every actor (user, frontend, API, service, database, external systems). Flowcharts are for branching logic only. Trace the COMPLETE path — if there's a cron job that calls an executor that calls an external API, show all three, not just "cron → external API."
99
- - **Data Model** must show actual column names, types, and descriptions for primary tables not just entity names in an ER diagram. Read the actual schema/types files. Include fields that carry important semantics (e.g., `session_id` for context continuity, `webhook_url` for per-config endpoints).
100
- - **Error Handling & Edge Cases** — list specific failure scenarios: "If the user's OAuth token expires, the system does X. The user sees Y." Not generic "errors are logged." Think: what breaks at 2 AM with no user present?
101
- - **Security** — document auth patterns, service roles, secrets, access control. If a background job bypasses RLS with a service role, say so. If an endpoint is guarded by a bearer token, document it.
102
- - **Constraints & Decisions** is the most valuable section. Dig into the code for non-obvious choices: "Uses polling instead of websockets because...", "Auth tokens expire in 15min because...". If you can't find the reason, state the constraint and mark it: `Reason: unknown verify with team`.
103
- - **Related Features** must reference other docs by filename and explain the coupling: "Changes to the JWT schema will require updates to API_REFERENCE_DOC.md (auth middleware affects all endpoints)."
104
- - **Configuration** must list actual env vars/secrets from the code, not hypothetical ones.
105
- - **Key Files** — list every file in the execution path, not just the "main" files. If a cron handler, executor, service, and DB helper are all involved, list all of them.
149
+ - **Key Files** list every file in the execution path with a Type column (Source, Test, Config, Migration, Script, Route, Hook, Store). Include test files and config files, not just source. If a cron handler, executor, service, and DB helper are all involved, list all of them.
150
+ - **Testing** — include the test run command, test file locations, what's covered, coverage gaps (honest assessment), and manual testing steps. This is critical for AI coders and onboarding developers.
151
+ - **Common Tasks** — cookbook-style recipes for recurring modifications: "To add a new payment method, do X, Y, Z." [CONDITIONAL: omit for features with no recurring modification patterns]
152
+ - **Data Model** must show actual column names, types, and descriptions for primary tables not just entity names in an ER diagram. Read the actual schema/types files. [CONDITIONAL: omit for features without persistent state]
153
+ - **Error Handling & Edge Cases** list specific failure scenarios: "If the user's OAuth token expires, the system does X. The user sees Y." Not generic "errors are logged." Think: what breaks at 2 AM with no user present? [CONDITIONAL: omit for features with no non-obvious failure modes]
154
+ - **Constraints & Decisions** is the most valuable section. Dig into the code for non-obvious choices: "Uses polling instead of websockets because...", "Auth tokens expire in 15min because...". Include security considerations here — auth patterns, access control, secrets. If you can't find the reason, state the constraint and mark it: `Reason: unknown — verify with team`.
155
+ - **Related Features** — structured table with Doc, Relationship (depends on / depended by / shares data with), and Blast radius columns. Reference other docs by filename. Also populate the `relatedDocs` frontmatter array with the same filenames.
156
+ - **Change Log** — add initial entry with today's date and "Initial documentation".
106
157
 
107
158
  ## Step 4 — Manifest
108
159
 
109
- Create `vdocs/_manifest.json` using the schema in `.agents/vdoc/manifest-schema.json`.
160
+ Create `vdocs/_manifest.json` using the schema in [manifest-schema.json](./manifest-schema.json).
161
+
162
+ **Transfer the Fingerprint** from the exploration log into the manifest's top-level `fingerprint` object. This preserves the project identity metadata alongside the documentation inventory.
110
163
 
111
164
  The `description` field is critical — write it rich enough that you can route any user question to the right doc by matching against descriptions. Include specific technology names, patterns, and concepts.
112
165
 
166
+ The `deps` field lists feature names (matching other entries' titles) that would break or behave differently if this feature changes. Populate from the Related Features table's "depends on" and "depended by" relationships. This enables blast radius analysis by downstream consumers.
167
+
113
168
  Example:
114
169
 
115
170
  ```json
116
171
  {
117
- "filepath": "AUTHENTICATION_DOC.md",
118
- "title": "Authentication - OAuth2 & JWT",
119
- "version": "1.0.0",
120
- "description": "OAuth2 flow with Google/GitHub providers, JWT token lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
121
- "tags": ["oauth2", "jwt", "session-management", "rbac"]
172
+ "project": "my-project",
173
+ "fingerprint": {
174
+ "languages": ["TypeScript"],
175
+ "frameworks": ["Next.js 14", "Prisma", "NextAuth"],
176
+ "archetypes": ["Full-stack Framework"],
177
+ "scope": "~85 files, medium"
178
+ },
179
+ "documentation": [
180
+ {
181
+ "filepath": "AUTHENTICATION_DOC.md",
182
+ "title": "Authentication - OAuth2 & JWT",
183
+ "version": "1.0.0",
184
+ "description": "OAuth2 flow with Google/GitHub providers, JWT token lifecycle, session management via NextAuth.js, route protection middleware, and role-based access control.",
185
+ "tags": ["oauth2", "jwt", "session-management", "rbac"],
186
+ "deps": ["user-profile", "billing", "api-reference"]
187
+ }
188
+ ]
122
189
  }
123
190
  ```
124
191
 
125
- ## Step 5 — Self-Review
192
+ ## Step 5 — Generate Context Slices
193
+
194
+ For each generated doc, create a token-optimized context slice at `vdocs/_slices/{FEATURE_NAME}_SLICE.md`.
195
+
196
+ A context slice contains ONLY these sections extracted from the full doc:
197
+ - **Overview** (first paragraph only)
198
+ - **Business Rules** (full section)
199
+ - **Key Files** table (full table)
200
+ - **Constraints & Decisions** (full section)
201
+ - **Related Features** table (full table)
202
+
203
+ Format:
204
+
205
+ ```markdown
206
+ <!-- Context slice for {Feature Title} — auto-generated, do not edit manually -->
207
+ <!-- Full doc: vdocs/{FEATURE_NAME_DOC}.md -->
208
+
209
+ # {Feature Title}
210
+
211
+ {First paragraph of Overview}
212
+
213
+ ## Business Rules
214
+ {Full Business Rules section}
215
+
216
+ ## Key Files
217
+ {Full Key Files table}
218
+
219
+ ## Constraints & Decisions
220
+ {Full Constraints & Decisions section}
221
+
222
+ ## Related Features
223
+ {Full Related Features table}
224
+ ```
225
+
226
+ These slices are designed for AI agent consumption — compact enough to include in context packs without exceeding token budgets. They auto-regenerate whenever the parent doc is created or updated.
227
+
228
+ ## Step 6 — Self-Review
126
229
 
127
230
  Before finishing, verify:
128
231
 
232
+ - [ ] Every doc has valid YAML frontmatter (title, description, tags, version, keyFiles, relatedDocs, lastUpdated)
233
+ - [ ] Frontmatter `keyFiles` matches the Key Files table entries
234
+ - [ ] Frontmatter `relatedDocs` matches the Related Features table doc filenames
129
235
  - [ ] Every doc has at least one mermaid diagram in "How It Works"
130
236
  - [ ] Every doc has at least 2 entries in "Constraints & Decisions"
131
- - [ ] Every doc's "Key Files" lists real paths that exist in the codebase
132
- - [ ] Every doc's "Configuration" lists actual env vars from the code
133
- - [ ] Every doc's "Related Features" references other doc filenames
237
+ - [ ] Every doc's Key Files lists real paths that exist in the codebase (include Type column)
238
+ - [ ] Every doc has a Testing section with run command and coverage info
239
+ - [ ] Every doc's Related Features uses the structured table format (Doc, Relationship, Blast radius)
240
+ - [ ] Manifest entries include `deps` arrays populated from Related Features
134
241
  - [ ] Manifest `description` is detailed enough for semantic routing
135
242
  - [ ] No doc is just a shallow restatement of file names — each explains WHY and HOW
136
- - [ ] Every doc has "User Workflows" with at least one step-by-step journey
137
- - [ ] Every doc has specific "Error Handling & Edge Cases" (not generic)
138
- - [ ] Every doc has a "Security" section documenting auth/access patterns
243
+ - [ ] Every doc has "Business Rules" with at least one plain-language rule
244
+ - [ ] CONDITIONAL sections are omitted (not left empty) when not relevant
245
+ - [ ] Context slices exist in `vdocs/_slices/` for every generated doc
246
+ - [ ] Planning artifacts are in `vdocs/_planning/` (exploration log, doc plan)
@@ -4,13 +4,20 @@
4
4
  "created_at": "<ISO-8601>",
5
5
  "last_updated": "<ISO-8601>",
6
6
  "last_commit": "<short-sha>",
7
+ "fingerprint": {
8
+ "languages": ["<language>"],
9
+ "frameworks": ["<framework>"],
10
+ "archetypes": ["<archetype>"],
11
+ "scope": "<file-count-and-size-category>"
12
+ },
7
13
  "documentation": [
8
14
  {
9
15
  "filepath": "FEATURE_NAME_DOC.md",
10
16
  "title": "Human-Readable Feature Title",
11
17
  "version": "1.0.0",
12
18
  "description": "Rich semantic description with specific technology names, patterns, and concepts. Detailed enough that an AI can route any user question to this doc by matching against this field.",
13
- "tags": ["keyword-1", "keyword-2"]
19
+ "tags": ["keyword-1", "keyword-2"],
20
+ "deps": ["<feature-name-that-breaks-if-this-changes>"]
14
21
  }
15
22
  ]
16
23
  }
@@ -1,6 +1,6 @@
1
1
  # Audit Workflow
2
2
 
3
- Detect stale, missing, and dead documentation. Report and patch. Do NOT create scripts, shell files, scanners, or any tooling — use your built-in tools (Read, Glob, Grep, Bash for git commands) for everything.
3
+ Detect stale, missing, dead, and low-quality documentation. Report and patch. Do NOT create scripts, shell files, scanners, or any tooling — use your built-in tools (Read, Glob, Grep, Bash for git commands) for everything.
4
4
 
5
5
  ## Step 1 — Read Current State
6
6
 
@@ -10,7 +10,7 @@ Read `vdocs/_manifest.json`. Load the list of documented features and their meta
10
10
 
11
11
  Run `git log --name-only --since="<last_updated>" --pretty=format:""` or use `git diff` to find all source files that changed since the last audit.
12
12
 
13
- Cross-reference changed files against each doc's "Key Files" section to identify which docs are stale.
13
+ Cross-reference changed files against each doc's `keyFiles` frontmatter (or Key Files section) to identify which docs are stale.
14
14
 
15
15
  ## Step 3 — Detect Coverage Gaps
16
16
 
@@ -24,15 +24,36 @@ If you find undocumented features, propose new docs.
24
24
 
25
25
  ## Step 4 — Detect Dead Docs
26
26
 
27
- Check each doc's "Key Files" section against the actual filesystem. If key files no longer exist, the doc may be dead. Flag it: "PAYMENT_PROCESSING_DOC.md references 3 files that no longer exist — remove or archive?"
27
+ Check each doc's Key Files (from frontmatter `keyFiles` and the Key Files table) against the actual filesystem. If key files no longer exist, the doc may be dead. Flag it: "PAYMENT_PROCESSING_DOC.md references 3 files that no longer exist — remove or archive?"
28
28
 
29
29
  ## Step 5 — Check Cross-References
30
30
 
31
- Read each doc's "Related Features" section. Verify that:
32
- - Referenced doc filenames still exist
31
+ Read each doc's Related Features table and `relatedDocs` frontmatter. Verify that:
32
+ - Referenced doc filenames still exist in `vdocs/` and in `_manifest.json`
33
+ - The `deps` array in the manifest matches the Related Features table
33
34
  - The described coupling is still accurate (skim the relevant code)
34
35
 
35
- ## Step 6 — Report
36
+ ## Step 6 — Quality Score
37
+
38
+ Run mechanical quality checks on each doc. Score = percentage of checks passing.
39
+
40
+ | # | Check | How to verify |
41
+ |---|-------|---------------|
42
+ | 1 | Valid YAML frontmatter | Has all required fields: title, description, tags, version, keyFiles, relatedDocs, lastUpdated |
43
+ | 2 | CORE sections present and non-empty | Overview, Business Rules, How It Works, Key Files, Testing, Constraints & Decisions, Related Features all exist with content |
44
+ | 3 | Key File paths exist | Every path in frontmatter `keyFiles` and Key Files table resolves to a real file |
45
+ | 4 | How It Works has a diagram | Contains at least one `mermaid` code block |
46
+ | 5 | Business Rules has ≥1 rule | At least one bullet point in the section |
47
+ | 6 | relatedDocs resolve | Every filename in frontmatter `relatedDocs` exists in `vdocs/` |
48
+ | 7 | lastUpdated freshness | Delta between `lastUpdated` and latest git blame on key files is within acceptable range |
49
+ | 8 | Testing section has run command | Contains a code-formatted command string |
50
+
51
+ **Score thresholds:**
52
+ - **80-100%** — Good quality
53
+ - **60-79%** — Acceptable, minor improvements suggested
54
+ - **Below 60%** — Low quality — generate a "quality fix" task
55
+
56
+ ## Step 7 — Report
36
57
 
37
58
  Present a clear report:
38
59
 
@@ -43,6 +64,11 @@ STALE (source files changed):
43
64
  - AUTHENTICATION_DOC.md — src/lib/auth.ts changed (added GitHub provider)
44
65
  - API_REFERENCE_DOC.md — 2 new endpoints added
45
66
 
67
+ QUALITY SCORES:
68
+ - AUTHENTICATION_DOC.md — 88% (Good) ✓
69
+ - API_REFERENCE_DOC.md — 50% (Low) ✗ Missing: Business Rules, Testing section, mermaid diagram
70
+ - DATABASE_SCHEMA_DOC.md — 75% (Acceptable) ~ Missing: Testing section
71
+
46
72
  COVERAGE GAPS (undocumented features):
47
73
  - src/services/notification.ts — no doc covers notifications
48
74
 
@@ -51,17 +77,20 @@ DEAD DOCS (source files removed):
51
77
 
52
78
  CROSS-REF ISSUES:
53
79
  - AUTHENTICATION_DOC.md references BILLING_DOC.md which no longer exists
80
+ - Manifest deps for PAYMENTS_DOC.md lists "invoicing" but no invoicing doc exists
54
81
 
55
82
  CURRENT (no changes needed):
56
- - DATABASE_SCHEMA_DOC.md
57
- - PROJECT_OVERVIEW_DOC.md
83
+ - PROJECT_OVERVIEW_DOC.md — 100% quality
58
84
 
59
85
  Proceed with fixes?
60
86
  ```
61
87
 
62
88
  Wait for user direction, then:
63
89
  - Patch stale docs (re-read source files, update affected sections only)
90
+ - Fix low-quality docs (add missing CORE sections, fix broken key file paths)
64
91
  - Generate new docs for coverage gaps (follow create workflow for each)
65
92
  - Flag dead docs for user to confirm deletion
66
- - Fix cross-reference issues
67
- - Update manifest: bump versions, update `last_updated`, `last_commit`
93
+ - Fix cross-reference issues (update relatedDocs frontmatter + manifest deps)
94
+ - Regenerate context slices for any patched/updated docs in `vdocs/_slices/`
95
+ - Update manifest: bump `version`, update `last_updated`, `last_commit`, fix `deps` arrays
96
+ - Bump frontmatter `version` (increment by 1) and `lastUpdated` on every patched doc