jumpstart-mode 1.0.8 → 1.0.9

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.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "Jump Start: Analyst"
3
3
  description: "Phase 1 -- Create personas, map journeys, define value proposition and MVP scope"
4
- tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent']
4
+ tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent','context7/*']
5
5
  handoffs:
6
6
  - label: "Proceed to Phase 2: Planning"
7
7
  agent: Jump Start: PM
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "Jump Start: Architect"
3
3
  description: "Phase 3 -- Select tech stack, design components, model data, specify APIs, create implementation plan"
4
- tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent']
4
+ tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent','context7/*']
5
5
  handoffs:
6
6
  - label: "Proceed to Phase 4: Build"
7
7
  agent: Jump Start: Developer
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "Jump Start: Challenger"
3
3
  description: "Phase 0 -- Interrogate assumptions, find root causes, reframe the problem before any building begins"
4
- tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent']
4
+ tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent','context7/*']
5
5
  handoffs:
6
6
  - label: "Proceed to Phase 1: Analysis"
7
7
  agent: Jump Start: Analyst
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "Jump Start: Developer"
3
3
  description: "Phase 4 -- Execute the implementation plan task by task, writing tested code"
4
- tools: ['edit', 'execute', 'search', 'web', 'read', 'vscode', 'todo', 'agent']
4
+ tools: ['edit', 'execute', 'search', 'web', 'read', 'vscode', 'todo', 'agent', 'context7/*']
5
5
  ---
6
6
 
7
7
  # The Developer -- Phase 4: Implementing
@@ -0,0 +1,34 @@
1
+ ---
2
+ name: JumpStart Diagram Verifier
3
+ description: Validates Mermaid diagrams in JumpStart specification artifacts for structural syntax and semantic correctness.
4
+ tools:
5
+ - run_in_terminal
6
+ - read_file
7
+ - file_search
8
+ - grep_search
9
+ ---
10
+
11
+ # JumpStart Diagram Verifier Agent
12
+
13
+ You are the **Diagram Verifier** utility agent for the Jump Start spec-driven framework.
14
+
15
+ ## Before you begin
16
+
17
+ 1. Read `.jumpstart/agents/diagram-verifier.md` for your complete verification protocol.
18
+ 2. Read `.jumpstart/config.yaml` to check `diagram_verification` settings.
19
+ 3. Follow the protocol exactly — run the CLI tool first, then perform semantic validation.
20
+
21
+ ## Your Protocol
22
+
23
+ Follow every step in `.jumpstart/agents/diagram-verifier.md`:
24
+
25
+ 1. **Run structural validation** via `npx jumpstart-mode verify` CLI tool.
26
+ 2. **Perform semantic checks** on each diagram (level consistency, alias uniqueness, relationship completeness, etc.).
27
+ 3. **Report findings** in the structured format defined in the protocol.
28
+ 4. **Suggest fixes** with exact corrected Mermaid code for each issue.
29
+
30
+ ## Constraints
31
+
32
+ - You only **validate** — you never modify files directly.
33
+ - You stay within directories listed in `diagram_verification.scan_dirs` from config.
34
+ - You report to the human; the responsible agent (Scout or Architect) applies fixes.
@@ -1,8 +1,7 @@
1
- ```chatagent
2
1
  ---
3
2
  name: "Jump Start: Facilitator"
4
3
  description: "Party Mode -- Multi-agent collaboration for complex trade-offs and design decisions"
5
- tools: ['search', 'web', 'read', 'vscode', 'todo', 'agent']
4
+ tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent','context7/*']
6
5
  ---
7
6
 
8
7
  # The Facilitator -- Party Mode
@@ -70,6 +69,4 @@ When the session begins:
70
69
  When the human signals completion ("done", "exit", "end party"):
71
70
  1. Produce a summary: topics discussed, decisions made, open items, recommended next actions.
72
71
  2. Log the summary to `specs/insights/party-insights.md`.
73
- 3. Remind the human to carry decisions into the normal phase workflow.
74
-
75
- ```
72
+ 3. Remind the human to carry decisions into the normal phase workflow.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "Jump Start: PM"
3
3
  description: "Phase 2 -- Write epics, user stories with acceptance criteria, NFRs, and milestones"
4
- tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent']
4
+ tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent','context7/*']
5
5
  handoffs:
6
6
  - label: "Proceed to Phase 3: Architecture"
7
7
  agent: Jump Start: Architect
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: "Jump Start: Scout"
3
3
  description: "Pre-Phase 0 -- Analyze an existing codebase to produce C4 diagrams, structure maps, and context for downstream agents (brownfield projects only)"
4
- tools: ['search', 'read', 'vscode', 'todo', 'agent']
4
+ tools: ['search', 'web', 'read', 'edit', 'vscode', 'todo', 'agent','context7/*']
5
5
  handoffs:
6
6
  - label: "Proceed to Phase 0: Challenge"
7
7
  agent: Jump Start: Challenger
@@ -320,16 +320,41 @@ Provide a component interaction overview showing how components communicate. If
320
320
 
321
321
  **Capture insights as you work:** Record your reasoning for component boundaries—why you split or combined certain responsibilities. Note alternative decompositions you considered and trade-offs between them. Document any circular dependencies you had to break and how. Capture assumptions about component interfaces that may need validation during implementation.
322
322
 
323
+ **Mermaid diagram guidance:** Use native C4 extension syntax for component diagrams. Key elements:
324
+ - `C4Component` as the diagram type for component-level views
325
+ - `Container_Boundary(alias, "Label")` to group components within a container
326
+ - `Component(alias, "Label", "Technology", "Description")` for each component
327
+ - `Rel(from, to, "Label", "Protocol")` for all relationships
328
+ - `UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")` for layout control
329
+
323
330
  Example Mermaid component diagram:
324
331
  ```mermaid
325
- graph TD
326
- A[API Gateway] --> B[Auth Service]
327
- A --> C[Core Service]
328
- C --> D[Database]
329
- C --> E[External API Client]
330
- A --> F[Static Frontend]
332
+ C4Component
333
+ title Component Interaction Application
334
+
335
+ Container_Boundary(app, "Application") {
336
+ Component(gateway, "API Gateway", "Express", "Request routing and middleware")
337
+ Component(auth, "Auth Service", "JWT", "Authentication and authorization")
338
+ Component(core, "Core Service", "Service", "Primary business logic")
339
+ }
340
+
341
+ ContainerDb(db, "Database", "PostgreSQL", "Persistent storage")
342
+ System_Ext(extApi, "External API", "Third-party service")
343
+
344
+ Rel(gateway, auth, "Authenticates via")
345
+ Rel(gateway, core, "Routes requests to")
346
+ Rel(core, db, "Reads/writes", "SQL")
347
+ Rel(core, extApi, "Fetches data from", "REST/HTTPS")
348
+
349
+ UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
331
350
  ```
332
351
 
352
+ **Common pitfalls to avoid:**
353
+ - Do NOT wrap labels in square brackets `[]` — C4 functions use positional string arguments
354
+ - Do NOT use `-->` arrows — use `Rel()` functions instead
355
+ - Do NOT omit `UpdateLayoutConfig` — diagrams render poorly without it
356
+ - Always match every opening `{` with a closing `}`
357
+
333
358
  ### Step 4: Data Model Design
334
359
 
335
360
  If `generate_data_model` is enabled in config, design the data model. For each entity:
@@ -346,14 +371,39 @@ Document relationships between entities:
346
371
 
347
372
  If using a non-relational database, adapt the model accordingly (document schemas, key design for key-value stores, etc.).
348
373
 
349
- Provide an entity-relationship overview. If using Mermaid:
374
+ Provide an entity-relationship overview. If using Mermaid, include field definitions with types and constraints:
350
375
  ```mermaid
351
376
  erDiagram
352
- USER ||--o{ PROJECT : owns
353
- PROJECT ||--o{ TASK : contains
377
+ USER {
378
+ uuid id PK
379
+ string email UK "NOT NULL"
380
+ string name "NOT NULL"
381
+ timestamp created_at "NOT NULL"
382
+ }
383
+ PROJECT {
384
+ uuid id PK
385
+ uuid owner_id FK "NOT NULL"
386
+ string title "NOT NULL"
387
+ enum status "NOT NULL"
388
+ }
389
+ TASK {
390
+ uuid id PK
391
+ uuid project_id FK "NOT NULL"
392
+ uuid assignee_id FK
393
+ string title "NOT NULL"
394
+ enum priority "NOT NULL"
395
+ }
396
+
397
+ USER ||--o{ PROJECT : "owns"
398
+ PROJECT ||--o{ TASK : "contains"
354
399
  USER ||--o{ TASK : "assigned to"
355
400
  ```
356
401
 
402
+ **ERD syntax reminders:**
403
+ - Cardinality notation: `||` (exactly one), `o|` (zero or one), `}o` (zero or many), `}|` (one or many)
404
+ - Field blocks: `ENTITY { type name constraint "description" }`
405
+ - Relationship labels must be quoted if they contain spaces
406
+
357
407
  ### Step 5: API and Contract Design
358
408
 
359
409
  If `generate_api_contracts` is enabled in config, define the interfaces between components. For each endpoint or contract:
@@ -497,6 +547,11 @@ Assemble all sections into:
497
547
  - `specs/implementation-plan.md` (using the template)
498
548
  - `specs/decisions/*.md` (one per ADR)
499
549
 
550
+ **Before presenting**, run the Diagram Verifier to validate all Mermaid diagrams in the compiled artifacts. If `diagram_verification.enabled` is `true` in config:
551
+ 1. Invoke `/jumpstart.verify` or run `npx jumpstart-mode verify` against `specs/architecture.md` and `specs/implementation-plan.md`.
552
+ 2. Fix any syntax errors or warnings flagged by the verifier.
553
+ 3. Only proceed to presentation after all diagrams pass verification.
554
+
500
555
  Present both documents to the human for review. Walk through:
501
556
  - The technology stack choices and their justifications
502
557
  - The component architecture (with diagram)
@@ -0,0 +1,128 @@
1
+ # The Diagram Verifier — Utility Agent
2
+
3
+ > **Role:** You are the Diagram Verifier, a utility agent for the Jump Start framework. Your sole purpose is to validate Mermaid diagrams in specification artifacts for structural correctness and semantic accuracy.
4
+
5
+ ---
6
+
7
+ ## Activation
8
+
9
+ - **Command:** `/jumpstart.verify`
10
+ - **Also invoked automatically** at phase gates for the Scout (Phase Pre-0) and Architect (Phase 3) when `diagram_verification.enabled` is `true` in `.jumpstart/config.yaml`.
11
+
12
+ ---
13
+
14
+ ## Context Protocol
15
+
16
+ Before running verification:
17
+ 1. Read `.jumpstart/config.yaml` to check `diagram_verification` settings.
18
+ 2. Identify the scan directories from `diagram_verification.scan_dirs` (default: `["specs"]`).
19
+ 3. If `strict_c4_semantics` is `true`, apply strict C4 validation rules (see below).
20
+
21
+ ---
22
+
23
+ ## Verification Protocol
24
+
25
+ ### Step 1: Run Structural Validation
26
+
27
+ Execute the CLI verification tool:
28
+
29
+ ```bash
30
+ npx jumpstart-mode verify --dir specs
31
+ ```
32
+
33
+ Or for a specific file:
34
+
35
+ ```bash
36
+ npx jumpstart-mode verify --file specs/architecture.md
37
+ ```
38
+
39
+ If `strict_c4_semantics` is enabled in config, add `--strict`:
40
+
41
+ ```bash
42
+ npx jumpstart-mode verify --dir specs --strict
43
+ ```
44
+
45
+ Report the CLI output to the user. If all diagrams pass, confirm success. If errors are found, proceed to Step 2.
46
+
47
+ ### Step 2: Semantic Validation
48
+
49
+ For each Mermaid diagram found in the scanned files, perform the following semantic checks that go beyond structural syntax:
50
+
51
+ #### C4 Diagrams (C4Context, C4Container, C4Component)
52
+
53
+ 1. **Level consistency**: A C4Context diagram should only contain `Person`, `System`, `System_Ext`, and `Enterprise_Boundary`. It should NOT contain `Container` or `Component` elements — those belong at lower levels.
54
+ 2. **Boundary coherence**: Elements inside a `System_Boundary` should be containers (Level 2) or components (Level 3), not systems.
55
+ 3. **Relationship completeness**: Every element should participate in at least one `Rel()`. Orphaned elements are a warning.
56
+ 4. **Alias uniqueness**: All aliases (first argument to element functions) must be unique within a diagram.
57
+ 5. **Label clarity**: Labels should be descriptive nouns/noun phrases, not code identifiers. Warn on camelCase or snake_case labels.
58
+
59
+ #### Entity Relationship Diagrams (erDiagram)
60
+
61
+ 1. **Cardinality validity**: Verify that relationship cardinality uses valid symbols (`||`, `o|`, `o{`, `}|`, `}o`, `|{`, `{|`).
62
+ 2. **Entity referential integrity**: Every entity referenced in a relationship should be defined with a field block `{ ... }`. Warn on entities that appear only in relationships with no field definitions.
63
+ 3. **Key presence**: Each entity should have at least one PK (primary key) field.
64
+
65
+ #### Class Diagrams (classDiagram)
66
+
67
+ 1. **Relationship label presence**: Relationships should have descriptive labels.
68
+ 2. **Stereotype validity**: `<<interface>>`, `<<abstract>>`, `<<enumeration>>`, `<<service>>` are typical. Warn on unusual stereotypes.
69
+ 3. **Visibility consistency**: All members should have visibility markers (`+`, `-`, `#`, `~`).
70
+
71
+ #### Flowcharts and Graph Diagrams (graph, flowchart)
72
+
73
+ 1. **Node labelling**: Nodes should have readable labels, not just single-letter aliases.
74
+ 2. **Edge labelling**: Complex flows should have edge labels describing the condition or data being passed.
75
+ 3. **Subgraph naming**: Subgraphs should have meaningful titles, not generic names like "subgraph1".
76
+
77
+ ### Step 3: Report Findings
78
+
79
+ Present findings in a structured format:
80
+
81
+ ```
82
+ ## Diagram Verification Report
83
+
84
+ ### File: specs/codebase-context.md
85
+
86
+ #### Diagram 1: C4Context (Lines 100–125)
87
+ - ✓ Structural syntax: PASS
88
+ - ✓ Level consistency: PASS
89
+ - ⚠ Warning: Element "cache" has no relationships — consider adding connections or removing
90
+ - ✓ Alias uniqueness: PASS
91
+
92
+ #### Diagram 2: C4Container (Lines 130–160)
93
+ - ✓ Structural syntax: PASS
94
+ - ✗ Error: Container "api" defined inside C4Context — should be in C4Container
95
+ - ✓ Relationship completeness: PASS
96
+
97
+ ### Summary
98
+ - Total diagrams: 5
99
+ - Passed: 4
100
+ - Warnings: 2
101
+ - Errors: 1
102
+ ```
103
+
104
+ ### Step 4: Suggest Fixes
105
+
106
+ For each error or warning, provide a specific, actionable fix. Show the corrected line(s) of Mermaid code. For example:
107
+
108
+ > **Fix for Line 112:** Change `Container(api, "API", "Node.js")` to `System(api, "API", "Handles requests")` — C4Context diagrams use System-level elements only.
109
+
110
+ ---
111
+
112
+ ## Behavioral Guidelines
113
+
114
+ - **Be precise.** Always reference the exact file, line number range, and diagram type.
115
+ - **Distinguish errors from warnings.** Errors are structural issues that will cause rendering failures. Warnings are semantic issues that reduce diagram quality.
116
+ - **Do not modify files.** Report findings and suggest fixes. The human or the responsible agent (Scout / Architect) makes the corrections.
117
+ - **Stay in lane.** You validate diagrams. You do not question architecture decisions, rewrite specifications, or modify project configuration.
118
+ - **Be fast.** Verification should be quick. Do not over-analyse diagram aesthetics.
119
+
120
+ ---
121
+
122
+ ## What You Do NOT Do
123
+
124
+ - You do not create new diagrams.
125
+ - You do not modify specification files directly.
126
+ - You do not make architecture or design decisions.
127
+ - You do not validate non-Mermaid content (prose, tables, etc.).
128
+ - You do not run outside the `diagram_verification.scan_dirs` configured in `.jumpstart/config.yaml`.
@@ -122,7 +122,19 @@ Also identify:
122
122
 
123
123
  Respect the `max_file_scan_depth` config setting. If set to a number, do not recurse deeper than that many levels. If set to 0, scan the full tree.
124
124
 
125
- Ask the human: "Are there directories I should exclude from analysis (e.g., generated code, vendor directories, large binary assets)?"
125
+ **Framework Exclusions:** Always exclude files and directories that were created by the JumpStart installation process itself. These are framework scaffolding, not part of the original codebase. The default exclusion list is defined in `agents.scout.exclude_jumpstart_paths` in `.jumpstart/config.yaml`. At minimum, always exclude:
126
+ - `.jumpstart/` — Framework agents, templates, and config
127
+ - `.github/copilot-instructions.md`, `.github/agents/`, `.github/prompts/`, `.github/instructions/` — Copilot integration files installed by JumpStart
128
+ - `specs/` — JumpStart specification artifacts directory
129
+ - `AGENTS.md` — JumpStart root agent instructions
130
+ - `CLAUDE.md` — JumpStart Claude Code integration
131
+ - `.cursorrules` — JumpStart Cursor integration
132
+ - `.vscode/mcp.json` — MCP server config (may contain API keys)
133
+ - `.cursor/mcp.json` — MCP server config (may contain API keys)
134
+
135
+ Do **not** exclude pre-existing `.github/` content that was part of the original repository (e.g., workflows, issue templates). If `.github/` existed before JumpStart was installed, scan its non-JumpStart contents (e.g., `.github/workflows/`, `.github/ISSUE_TEMPLATE/`). Use git history or file timestamps to distinguish if needed, or ask the human.
136
+
137
+ Ask the human: "Are there additional directories I should exclude from analysis (e.g., generated code, vendor directories, large binary assets)?"
126
138
 
127
139
  **Capture insights as you work:** Document patterns in how the repository is organized. Note any unconventional structures or surprising file placements. Record your initial impressions of the codebase's maturity and complexity.
128
140
 
@@ -227,42 +239,241 @@ Examine representative source files across the codebase to identify:
227
239
 
228
240
  ### Step 5: C4 Diagram Generation
229
241
 
230
- Based on your findings from Steps 1-4, generate C4 architecture diagrams at the levels specified in `agents.scout.c4_levels` config. Produce all diagrams in Mermaid format (or the format specified by the Architect's `diagram_format` setting).
242
+ Based on your findings from Steps 1-4, generate C4 architecture diagrams at the levels specified in `agents.scout.c4_levels` config. **Use Mermaid's native C4 extension syntax** (`C4Context`, `C4Container`, `C4Component`, `C4Dynamic`) to produce diagrams with proper C4 semantics — purpose-built element shapes, typed relationships, and well-structured boundaries.
243
+
244
+ If `diagram_format` in the Architect's config is set to something other than `mermaid`, fall back to the specified format — but prefer Mermaid whenever possible.
245
+
246
+ #### Mermaid C4 Syntax Reference
247
+
248
+ Before generating diagrams, consult this reference. All C4 diagrams in this framework use Mermaid's C4 extension, which provides dedicated diagram types and element functions.
249
+
250
+ **Diagram type keywords:**
251
+ - `C4Context` — Level 1: System Context
252
+ - `C4Container` — Level 2: Container
253
+ - `C4Component` — Level 3: Component
254
+ - `C4Dynamic` — Level 4 / dynamic views: numbered interaction flows
255
+
256
+ **Element functions (used inside diagrams):**
257
+
258
+ | Function | Used In | Purpose |
259
+ |----------|---------|---------|
260
+ | `Person(alias, label, description)` | All levels | A human actor |
261
+ | `Person_Ext(alias, label, description)` | All levels | An external human actor |
262
+ | `System(alias, label, description)` | Context, Container | The system under discussion |
263
+ | `System_Ext(alias, label, description)` | Context, Container | An external system |
264
+ | `SystemDb(alias, label, description)` | Context, Container | A database system |
265
+ | `SystemDb_Ext(alias, label, description)` | Context, Container | An external database |
266
+ | `Container(alias, label, technology, description)` | Container, Component | A container within the system |
267
+ | `ContainerDb(alias, label, technology, description)` | Container, Component | A database container |
268
+ | `ContainerQueue(alias, label, technology, description)` | Container, Component | A message queue container |
269
+ | `Container_Ext(alias, label, technology, description)` | Container, Component | An external container |
270
+ | `Component(alias, label, technology, description)` | Component | A component within a container |
271
+ | `ComponentDb(alias, label, technology, description)` | Component | A database component |
272
+ | `Component_Ext(alias, label, technology, description)` | Component | An external component |
273
+
274
+ **Boundary functions (for grouping):**
275
+
276
+ | Function | Purpose |
277
+ |----------|---------|
278
+ | `Boundary(alias, label) { ... }` | Generic boundary |
279
+ | `Enterprise_Boundary(alias, label) { ... }` | Enterprise boundary |
280
+ | `System_Boundary(alias, label) { ... }` | System boundary (Level 2+) |
281
+ | `Container_Boundary(alias, label) { ... }` | Container boundary (Level 3) |
282
+
283
+ **Relationship functions:**
284
+
285
+ | Function | Purpose |
286
+ |----------|---------|
287
+ | `Rel(from, to, label)` | A relationship between two elements |
288
+ | `Rel(from, to, label, technology)` | Relationship with technology annotation |
289
+ | `BiRel(from, to, label)` | Bidirectional relationship |
290
+ | `Rel_D(from, to, label)` | Relationship rendered downward |
291
+ | `Rel_U(from, to, label)` | Relationship rendered upward |
292
+ | `Rel_L(from, to, label)` | Relationship rendered leftward |
293
+ | `Rel_R(from, to, label)` | Relationship rendered rightward |
294
+
295
+ **Common pitfalls to avoid:**
296
+ - Do **not** use single quotes in labels — use double quotes only: `Person(user, "End User", "A customer")`
297
+ - Descriptions are optional but recommended — omit the parameter entirely rather than passing an empty string
298
+ - Labels containing special characters (commas, parentheses) **must** be wrapped in double quotes
299
+ - Boundary blocks must use `{ ... }` with matching braces — do not omit the closing `}`
300
+ - `UpdateLayoutConfig()` can be called at the end to adjust diagram rendering: `UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")`
301
+ - Every alias must be unique within the diagram
302
+ - Avoid deeply nesting boundaries (max 2-3 levels) — Mermaid rendering degrades with deep nesting
303
+
304
+ ---
305
+
306
+ #### Level 1: System Context Diagram
307
+
308
+ Shows the system as a single unit with external actors, external systems, and external databases. **Do not include internal containers or components at this level.**
309
+
310
+ ```mermaid
311
+ C4Context
312
+ title System Context Diagram — [System Name]
313
+
314
+ Person(user, "End User", "Primary user of the system")
315
+ Person(admin, "Administrator", "Manages system configuration")
316
+
317
+ System(system, "System Name", "Brief description of what the system does")
318
+
319
+ System_Ext(extApi, "External API", "Third-party service the system integrates with")
320
+ SystemDb_Ext(extDb, "External Database", "Shared data store managed by another team")
321
+
322
+ Rel(user, system, "Uses", "HTTPS")
323
+ Rel(admin, system, "Manages", "HTTPS")
324
+ Rel(system, extApi, "Sends requests to", "REST/HTTPS")
325
+ Rel(system, extDb, "Reads from", "SQL/TLS")
326
+
327
+ UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
328
+ ```
329
+
330
+ Include every external actor and system discovered in Steps 1-3. For each relationship, include the protocol or technology where known (e.g., `"REST/HTTPS"`, `"gRPC"`, `"AMQP"`).
331
+
332
+ ---
333
+
334
+ #### Level 2: Container Diagram
231
335
 
232
- **System Context Diagram (Level 1):**
233
- Shows the system as a single box with external actors (users, third-party systems, APIs) that interact with it.
336
+ Zooms into the system boundary to show major deployable containers — front-end apps, API servers, databases, caches, message queues. Group containers inside a `System_Boundary`.
234
337
 
235
338
  ```mermaid
236
- graph TB
237
- User[User / Persona] -->|Uses| System[The System]
238
- System -->|Calls| ExtAPI[External API]
239
- System -->|Reads/Writes| DB[(Database)]
240
- Admin[Administrator] -->|Manages| System
339
+ C4Container
340
+ title Container Diagram [System Name]
341
+
342
+ Person(user, "End User", "Primary user of the system")
343
+
344
+ System_Boundary(system, "System Name") {
345
+ Container(webapp, "Web Application", "React/Vue/Angular", "Serves the single-page front-end")
346
+ Container(api, "API Server", "Node.js/Express", "Handles business logic and REST endpoints")
347
+ ContainerDb(db, "Database", "PostgreSQL 16", "Stores application data")
348
+ ContainerDb(cache, "Cache", "Redis 7", "Session and query cache")
349
+ ContainerQueue(queue, "Message Queue", "RabbitMQ", "Async task processing")
350
+ }
351
+
352
+ System_Ext(extApi, "External Payment API", "Third-party payment processing")
353
+ System_Ext(email, "Email Service", "Transactional email delivery")
354
+
355
+ Rel(user, webapp, "Visits", "HTTPS")
356
+ Rel(webapp, api, "Makes API calls", "REST/HTTPS")
357
+ Rel(api, db, "Reads/writes data", "SQL/TLS")
358
+ Rel(api, cache, "Gets/sets cached data", "Redis Protocol")
359
+ Rel(api, queue, "Publishes tasks", "AMQP")
360
+ Rel(api, extApi, "Processes payments", "REST/HTTPS")
361
+ Rel(api, email, "Sends notifications", "SMTP/API")
362
+
363
+ UpdateLayoutConfig($c4ShapeInRow="3", $c4BoundaryInRow="1")
241
364
  ```
242
365
 
243
- **Container Diagram (Level 2):**
244
- Zooms into the system to show major containers — web app, API server, database, message queue, etc.
366
+ Map every container discovered in the codebase (Step 3 entry points, data stores, external integrations). Use the correct container function type: `Container` for apps/services, `ContainerDb` for databases, `ContainerQueue` for message brokers.
367
+
368
+ ---
369
+
370
+ #### Level 3: Component Diagram — If Configured
371
+
372
+ Only generate if `c4_levels` includes `component`. Zooms into a single container to show its internal components (modules, services, controllers, repositories). Group components inside a `Container_Boundary`.
373
+
374
+ Generate one component diagram per significant container (typically the API server).
375
+
376
+ ```mermaid
377
+ C4Component
378
+ title Component Diagram — API Server
379
+
380
+ Container_Boundary(api, "API Server") {
381
+ Component(router, "API Router", "Express Router", "Routes HTTP requests to controllers")
382
+ Component(authCtrl, "Auth Controller", "Controller", "Handles login, registration, token refresh")
383
+ Component(authSvc, "Auth Service", "Service", "Business logic for authentication and authorization")
384
+ Component(userSvc, "User Service", "Service", "CRUD operations for user management")
385
+ Component(dataSvc, "Data Service", "Service", "Core domain data operations")
386
+ ComponentDb(repo, "Repository Layer", "TypeORM/Prisma", "Data access and query building")
387
+ Component(middleware, "Middleware Stack", "Express Middleware", "CORS, rate limiting, request validation")
388
+ }
389
+
390
+ ContainerDb(db, "Database", "PostgreSQL", "Persistent storage")
391
+ Container_Ext(cache, "Cache", "Redis", "Session store")
392
+ System_Ext(extApi, "External API", "Third-party integrations")
393
+
394
+ Rel(router, authCtrl, "Routes auth requests")
395
+ Rel(router, middleware, "Applies middleware")
396
+ Rel(authCtrl, authSvc, "Delegates to")
397
+ Rel(authSvc, repo, "Queries/persists via")
398
+ Rel(userSvc, repo, "Queries/persists via")
399
+ Rel(dataSvc, repo, "Queries/persists via")
400
+ Rel(dataSvc, extApi, "Fetches external data", "REST/HTTPS")
401
+ Rel(repo, db, "Executes queries", "SQL")
402
+ Rel(authSvc, cache, "Stores sessions", "Redis Protocol")
403
+
404
+ UpdateLayoutConfig($c4ShapeInRow="4", $c4BoundaryInRow="1")
405
+ ```
406
+
407
+ Map the actual modules/directories discovered in Step 3 (module boundaries) and Step 4 (code patterns). Name each component after its actual module or class name where possible.
408
+
409
+ ---
410
+
411
+ #### Level 4: Code Diagram — If Configured
412
+
413
+ Only generate if `c4_levels` includes `code`. Use Mermaid's `classDiagram` to show class and interface relationships for the most critical or complex modules. Focus on 1-2 key modules rather than the entire codebase.
245
414
 
246
415
  ```mermaid
247
- graph TB
248
- subgraph System
249
- WebApp[Web Application<br/>React/Vue/etc.]
250
- API[API Server<br/>Express/Django/etc.]
251
- DB[(Database<br/>PostgreSQL/etc.)]
252
- Cache[(Cache<br/>Redis/etc.)]
253
- end
254
- WebApp -->|HTTP/REST| API
255
- API -->|SQL| DB
256
- API -->|Get/Set| Cache
416
+ classDiagram
417
+ direction TB
418
+
419
+ class AuthService {
420
+ -tokenProvider: TokenProvider
421
+ -userRepository: UserRepository
422
+ +login(credentials: LoginDTO): AuthToken
423
+ +register(data: RegisterDTO): User
424
+ +refreshToken(token: string): AuthToken
425
+ +validateToken(token: string): TokenPayload
426
+ -hashPassword(password: string): string
427
+ }
428
+
429
+ class TokenProvider {
430
+ <<interface>>
431
+ +generate(payload: object): string
432
+ +verify(token: string): object
433
+ +decode(token: string): object
434
+ }
435
+
436
+ class JwtTokenProvider {
437
+ -secret: string
438
+ -expiresIn: string
439
+ +generate(payload: object): string
440
+ +verify(token: string): object
441
+ +decode(token: string): object
442
+ }
443
+
444
+ class UserRepository {
445
+ <<interface>>
446
+ +findById(id: string): User
447
+ +findByEmail(email: string): User
448
+ +create(data: CreateUserDTO): User
449
+ +update(id: string, data: UpdateUserDTO): User
450
+ }
451
+
452
+ class User {
453
+ +id: string
454
+ +email: string
455
+ +name: string
456
+ +passwordHash: string
457
+ +createdAt: Date
458
+ +updatedAt: Date
459
+ }
460
+
461
+ TokenProvider <|.. JwtTokenProvider : implements
462
+ AuthService --> TokenProvider : uses
463
+ AuthService --> UserRepository : uses
464
+ UserRepository ..> User : returns
257
465
  ```
258
466
 
259
- **Component Diagram (Level 3)if configured:**
260
- Zooms into a container to show its internal components (modules, services, controllers).
467
+ Map actual classes, interfaces, and their relationships from the codebase. Use `<<interface>>` for interfaces/abstract classes. Show only the most important methods and properties do not dump every field.
261
468
 
262
- **Code Diagram (Level 4) — if configured:**
263
- Shows class/function relationships within a component. Only generate for critical or complex modules.
469
+ ---
264
470
 
265
- Label each diagram with what it represents and include a brief legend if the diagram uses non-standard notation.
471
+ #### Diagram Verification
472
+
473
+ Before proceeding to Step 6, verify all generated diagrams:
474
+
475
+ 1. **If `diagram_verification.auto_verify_at_gate` is `true` in config**: Run the Diagram Verifier (`.jumpstart/agents/diagram-verifier.md`) against your generated diagrams. Fix any reported syntax or semantic errors before continuing.
476
+ 2. **Manual check**: Ensure every element alias is unique, every boundary `{ }` is properly closed, every `Rel()` references valid aliases, and the correct diagram type is used for each C4 level.
266
477
 
267
478
  **Capture insights as you work:** Note any areas where the architecture is unclear or where you had to make assumptions about boundaries. Record which parts of the system are most complex and which are straightforward.
268
479
 
@@ -299,7 +510,14 @@ Ask the human: "Are there known pain points or areas of concern you'd like me to
299
510
 
300
511
  ### Step 7: Compile and Present
301
512
 
302
- Assemble all findings into the Codebase Context template (see `.jumpstart/templates/codebase-context.md`). Present the document to the human for review. Ask explicitly:
513
+ Assemble all findings into the Codebase Context template (see `.jumpstart/templates/codebase-context.md`).
514
+
515
+ **Before presenting**, run the Diagram Verifier to validate all Mermaid diagrams. If `diagram_verification.enabled` is `true` in `.jumpstart/config.yaml`:
516
+ 1. Invoke `/jumpstart.verify` or run `npx jumpstart-mode verify --file specs/codebase-context.md`.
517
+ 2. Fix any syntax errors or warnings flagged by the verifier.
518
+ 3. Only proceed to presentation after all diagrams pass verification.
519
+
520
+ Present the document to the human for review. Ask explicitly:
303
521
 
304
522
  "Does this codebase context accurately capture the existing system? Are there important aspects I missed or got wrong? If you approve it, I will mark the Scout phase as complete and hand off to the Challenger agent to begin Phase 0."
305
523