devforgeai 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.
@@ -0,0 +1,724 @@
1
+ # DevForgeAI Architecture Documentation
2
+
3
+ **Version**: 1.0
4
+ **Date**: 2026-03-03
5
+ **Status**: Current
6
+
7
+ ---
8
+
9
+ ## Table of Contents
10
+
11
+ 1. [System Overview](#system-overview)
12
+ 2. [Component Architecture](#component-architecture)
13
+ 3. [Workflow Architecture](#workflow-architecture)
14
+ 4. [TDD Development Pipeline (12-Phase)](#tdd-development-pipeline-12-phase)
15
+ 5. [Hook System (EPIC-086)](#hook-system-epic-086)
16
+ 6. [Quality Gates](#quality-gates)
17
+ 7. [Key Design Decisions](#key-design-decisions)
18
+
19
+ ---
20
+
21
+ ## System Overview
22
+
23
+ DevForgeAI is a **spec-driven meta-framework** for AI-assisted software development. It operates on a constitutional model: six immutable context files constrain all AI agent behavior, preventing technical debt by design rather than detection.
24
+
25
+ The framework is **technology-agnostic** -- it does not mandate any backend, frontend, or database technology. Instead, it provides the scaffolding for consistent, quality-gated development workflows using any stack the user selects.
26
+
27
+ (Source: devforgeai/specs/context/tech-stack.md, lines 7-9)
28
+
29
+ ### Core Principles
30
+
31
+ - **Constitutional constraints**: 6 immutable context files define the law; agents must comply or HALT
32
+ - **Spec-driven development**: Every artifact traces to a specification (epic, story, acceptance criteria)
33
+ - **Zero technical debt by design**: Immutable specs, mandatory TDD, and strict quality gates prevent debt accumulation
34
+ - **Markdown-first**: All framework components are Markdown with YAML frontmatter, interpreted as natural language by AI agents
35
+ - **Framework-agnostic**: Works with any technology stack selected by the user
36
+
37
+ ---
38
+
39
+ ## Component Architecture
40
+
41
+ ```mermaid
42
+ graph TB
43
+ subgraph "Layer 3: User Interface"
44
+ Commands["Slash Commands<br/>(User Workflows)"]
45
+ end
46
+
47
+ subgraph "Layer 2: Framework Implementation"
48
+ Skills["26 Skills<br/>(Inline Prompt Expansions)"]
49
+ end
50
+
51
+ subgraph "Layer 1: Execution"
52
+ Subagents["44 Subagents<br/>(Isolated Specialists)"]
53
+ end
54
+
55
+ subgraph "Constitution"
56
+ Context["6 Immutable Context Files"]
57
+ end
58
+
59
+ subgraph "Infrastructure"
60
+ CLI["devforgeai-validate CLI<br/>(Python)"]
61
+ Hooks["Hook System<br/>(Shell Scripts)"]
62
+ Registry["Phase Steps Registry<br/>(72 steps / 12 phases)"]
63
+ end
64
+
65
+ User((User)) -->|invokes| Commands
66
+ Commands -->|delegates to| Skills
67
+ Commands -->|dispatches| Subagents
68
+ Skills -->|invokes| Skills
69
+ Skills -->|dispatches via Task()| Subagents
70
+
71
+ Skills -.->|reads| Context
72
+ Subagents -.->|reads| Context
73
+ Commands -.->|reads| Context
74
+
75
+ Skills -->|validates via| CLI
76
+ Hooks -->|enforces| Registry
77
+
78
+ Subagents -.x|CANNOT invoke| Skills
79
+ Skills -.x|CANNOT invoke| Commands
80
+ ```
81
+
82
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 9-26)
83
+
84
+ ### Orchestrator (opus)
85
+
86
+ The orchestrator is the top-level agent identity. It delegates all work to skills and subagents. Core responsibilities:
87
+
88
+ - Creates task lists for all work
89
+ - Provides context to subagents (they cannot see the full picture independently)
90
+ - HALTs on ambiguity and uses AskUserQuestion
91
+ - Never performs manual labor directly
92
+
93
+ ### Skills (26 total)
94
+
95
+ Skills are **inline prompt expansions**, not background processes. When invoked via `Skill(command="...")`, the skill's SKILL.md content expands inline and the orchestrator executes its phases sequentially.
96
+
97
+ | Category | Skills |
98
+ |----------|--------|
99
+ | **Discovery** | discovering-requirements, brainstorming, assessing-entrepreneur |
100
+ | **Architecture** | designing-systems, devforgeai-orchestration |
101
+ | **Story Management** | devforgeai-story-creation, story-remediation, validating-epic-coverage |
102
+ | **Development** | implementing-stories (12-phase TDD) |
103
+ | **Quality** | devforgeai-qa, devforgeai-qa-remediation |
104
+ | **Release** | devforgeai-release |
105
+ | **Diagnostics** | root-cause-diagnosis, devforgeai-rca, devforgeai-feedback, devforgeai-insights |
106
+ | **Tooling** | claude-code-terminal-expert, skill-creator, devforgeai-subagent-creation, devforgeai-mcp-cli-converter |
107
+ | **Documentation** | devforgeai-documentation |
108
+ | **Other** | cross-ai-collaboration, devforgeai-github-actions, devforgeai-research, devforgeai-ui-generator, auditing-w3-compliance |
109
+
110
+ Each skill follows the progressive disclosure pattern:
111
+ - `SKILL.md`: Core instructions (target 500-800 lines)
112
+ - `references/`: Deep documentation loaded on demand
113
+
114
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 28-46)
115
+
116
+ ### Subagents (44 total)
117
+
118
+ Subagents are isolated, domain-specialized agents dispatched via `Task()`. They follow the principle of least privilege -- each receives only the tools needed for its domain.
119
+
120
+ | Domain | Subagents |
121
+ |--------|-----------|
122
+ | **Testing** | test-automator, integration-tester |
123
+ | **Architecture** | backend-architect, frontend-developer, api-designer, architect-reviewer |
124
+ | **Code Quality** | code-reviewer, code-analyzer, code-quality-auditor, refactoring-specialist, anti-pattern-scanner, dead-code-detector |
125
+ | **Compliance** | ac-compliance-verifier, context-validator, context-preservation-validator, pattern-compliance-auditor, alignment-auditor |
126
+ | **Analysis** | framework-analyst, diagnostic-analyst, coverage-analyzer, dependency-graph-analyzer, technical-debt-analyzer |
127
+ | **Validation** | deferral-validator, git-validator, file-overlap-detector, security-auditor |
128
+ | **Interpretation** | dev-result-interpreter, qa-result-interpreter, ideation-result-interpreter, epic-coverage-result-interpreter, observation-extractor |
129
+ | **Planning** | sprint-planner, requirements-analyst, stakeholder-analyst, story-requirements-analyst, entrepreneur-assessor |
130
+ | **Operations** | deployment-engineer, git-worktree-manager, documentation-writer, session-miner, agent-generator, tech-stack-detector, ui-spec-formatter, internet-sleuth |
131
+
132
+ **Key constraints:**
133
+ - Single responsibility per subagent
134
+ - No shared state between parallel subagents
135
+ - Designed for parallel invocation (4-6 recommended, 10 max concurrent)
136
+
137
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 48-65)
138
+
139
+ ### Constitutional Context Files (6 immutable)
140
+
141
+ These files are **THE LAW**. They cannot be modified without an Architecture Decision Record (ADR).
142
+
143
+ | File | Purpose |
144
+ |------|---------|
145
+ | `tech-stack.md` | Locked technology decisions and tool constraints |
146
+ | `source-tree.md` | Canonical directory structure and file locations |
147
+ | `dependencies.md` | Approved dependency list |
148
+ | `coding-standards.md` | Code style and conventions |
149
+ | `architecture-constraints.md` | Three-layer architecture rules, design patterns |
150
+ | `anti-patterns.md` | Forbidden patterns with detection rules |
151
+
152
+ Location: `devforgeai/specs/context/`
153
+
154
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 83-101)
155
+
156
+ ### CLI (devforgeai-validate)
157
+
158
+ Python CLI for phase state management and validation:
159
+
160
+ ```bash
161
+ # Initialize phase state for a story
162
+ devforgeai-validate phase-init STORY-XXX
163
+
164
+ # Transition between phases
165
+ devforgeai-validate phase-check STORY-XXX --from=01 --to=02
166
+
167
+ # Mark phase complete
168
+ devforgeai-validate phase-complete STORY-XXX --phase=01 --checkpoint-passed
169
+
170
+ # Validate DoD format
171
+ devforgeai-validate validate-dod <story-file>
172
+ ```
173
+
174
+ ---
175
+
176
+ ## Workflow Architecture
177
+
178
+ ```mermaid
179
+ graph LR
180
+ B[BRAINSTORM] --> I[IDEATION]
181
+ I --> A[ARCHITECTURE]
182
+ A --> S[STORY]
183
+ S --> D["DEV<br/>(TDD 12-Phase)"]
184
+ D --> Q[QA]
185
+ Q --> R[RELEASE]
186
+
187
+ style D fill:#f9f,stroke:#333,stroke-width:2px
188
+ ```
189
+
190
+ ### Story Lifecycle States
191
+
192
+ ```mermaid
193
+ stateDiagram-v2
194
+ [*] --> Backlog
195
+ Backlog --> Architecture : Story created with AC
196
+ Architecture --> Ready : Context files validated (Gate 1)
197
+ Ready --> InDev : Developer assigned
198
+ InDev --> Complete : Tests pass, implementation done
199
+ Complete --> QA : Quality Gate 2 passed
200
+ QA --> Approved : All AC verified (Gate 3)
201
+ Approved --> Releasing : Release plan documented
202
+ Releasing --> Released : Deployment verified (Gate 4)
203
+ Released --> [*]
204
+ ```
205
+
206
+ ### Workflow-to-Skill Mapping
207
+
208
+ | Workflow Phase | Primary Skill | Key Subagents |
209
+ |----------------|---------------|---------------|
210
+ | Brainstorm | brainstorming | internet-sleuth |
211
+ | Ideation | discovering-requirements | requirements-analyst, stakeholder-analyst |
212
+ | Architecture | designing-systems | architect-reviewer, tech-stack-detector |
213
+ | Story | devforgeai-story-creation | story-requirements-analyst |
214
+ | Dev | implementing-stories | test-automator, backend-architect, frontend-developer, code-reviewer, integration-tester |
215
+ | QA | devforgeai-qa | anti-pattern-scanner, coverage-analyzer, security-auditor |
216
+ | Release | devforgeai-release | deployment-engineer |
217
+
218
+ ---
219
+
220
+ ## TDD Development Pipeline (12-Phase)
221
+
222
+ The `implementing-stories` skill executes a strict 12-phase TDD pipeline. No phase can be skipped without explicit user authorization.
223
+
224
+ | Phase | Name | Key Steps | Gate |
225
+ |-------|------|-----------|------|
226
+ | 01 | Pre-Flight Validation | Load context files, validate story, init phase state | phase-init |
227
+ | 02 | Test-First (Red) | test-automator writes failing tests, verify RED state, create integrity snapshot | All tests fail |
228
+ | 03 | Implementation (Green) | backend-architect/frontend-developer implements, verify GREEN state | All tests pass |
229
+ | 04 | Refactoring | refactoring-specialist improves, code-reviewer validates, light QA | Coverage thresholds met |
230
+ | 04.5 | AC Compliance (Post-Refactor) | ac-compliance-verifier checks no AC regression | All ACs pass |
231
+ | 05 | Integration & Validation | integration-tester writes integration tests, coverage validation | Coverage 95/85/80% |
232
+ | 05.5 | AC Compliance (Post-Integration) | ac-compliance-verifier re-checks | All ACs pass |
233
+ | 06 | Deferral Challenge | deferral-validator reviews, user approval for each deferral | User consent |
234
+ | 07 | DoD Update | Mark story DoD items, validate format | DoD validator passes |
235
+ | 08 | Git Workflow | Stage files, commit with validation | Commit succeeds |
236
+ | 09 | Feedback Hook | Collect observations, framework-analyst analyzes | Report written |
237
+ | 10 | Result Interpretation | dev-result-interpreter produces final result | Status updated |
238
+
239
+ **Total registered steps: 72** (tracked in `.claude/hooks/phase-steps-registry.json`)
240
+
241
+ ---
242
+
243
+ ## Hook System (EPIC-086)
244
+
245
+ The hook system provides external enforcement of workflow discipline through shell scripts that intercept tool usage, track subagent invocations, and validate step completion.
246
+
247
+ ```mermaid
248
+ flowchart TD
249
+ A[Agent requests tool use] --> B{pre-tool-use.sh}
250
+ B -->|Match SAFE pattern| C[Exit 0: Auto-approve]
251
+ B -->|Match BLOCKED pattern| D[Exit 2: Block]
252
+ B -->|No match| E[Exit 1: Ask user]
253
+
254
+ F[Subagent dispatched via Task] --> G[SubagentStop hook]
255
+ G --> H[track-subagent-invocation.sh]
256
+ H --> I[Record invocation in phase state]
257
+
258
+ J[Step marked complete] --> K[TaskCompleted hook]
259
+ K --> L[validate-step-completion.sh]
260
+ L --> M{Step in registry?}
261
+ M -->|Yes, valid| N[Exit 0: Pass]
262
+ M -->|No, missing required step| O[Exit 2: Block]
263
+ ```
264
+
265
+ ### Hook Components
266
+
267
+ | Hook | Script | Trigger | Purpose |
268
+ |------|--------|---------|---------|
269
+ | **pre-tool-use** | `pre-tool-use.sh` | Before any Bash command | Auto-approve safe commands (63 patterns), block dangerous ones (6 patterns) |
270
+ | **SubagentStop** | `track-subagent-invocation.sh` | After subagent completes | Record which subagents were invoked per phase for audit |
271
+ | **TaskCompleted** | `validate-step-completion.sh` | After step completion claim | Validate step exists in registry, enforce required steps |
272
+ | **post-qa-***.sh** | Various | After QA pass/fail/warn | Automated post-QA actions (reports, notifications) |
273
+ | **post-edit-write-check** | `post-edit-write-check.sh` | After Edit/Write | Enforce file location constraints |
274
+
275
+ ### Phase Steps Registry
276
+
277
+ The registry at `.claude/hooks/phase-steps-registry.json` defines 72 steps across 12 phases. Each step specifies:
278
+
279
+ ```json
280
+ {
281
+ "id": "03.2",
282
+ "check": "backend-architect OR frontend-developer subagent invoked",
283
+ "subagent": ["backend-architect", "frontend-developer"],
284
+ "conditional": false
285
+ }
286
+ ```
287
+
288
+ - **id**: Phase.Step identifier
289
+ - **check**: Human-readable description of what must happen
290
+ - **subagent**: Required subagent(s) or null for non-subagent steps
291
+ - **conditional**: Whether the step can be skipped based on context
292
+
293
+ ### Exit Code Convention
294
+
295
+ | Code | Meaning | Behavior |
296
+ |------|---------|----------|
297
+ | 0 | Pass / No-op | Proceed normally |
298
+ | 1 | Warning | Log and continue (or ask user for pre-tool-use) |
299
+ | 2 | Block | HALT workflow, require fix |
300
+
301
+ ---
302
+
303
+ ## Quality Gates
304
+
305
+ Four sequential gates enforce quality at each lifecycle transition. Gates cannot be skipped.
306
+
307
+ | Gate | Transition | Enforced By | Requirements |
308
+ |------|-----------|-------------|--------------|
309
+ | **1. Context Validation** | Architecture -> Ready | devforgeai-orchestration | All 6 context files present, valid syntax, no conflicts |
310
+ | **2. Test Passing** | Dev Complete -> QA | devforgeai-qa | All tests pass (exit 0), coverage 95/85/80%, no Critical/High violations |
311
+ | **3. QA Approval** | QA -> Releasing | devforgeai-release | Story has "QA APPROVED", all AC verified, runtime smoke test passes |
312
+ | **4. Release Readiness** | Releasing -> Released | devforgeai-release | Smoke tests pass, deployment verified, rollback plan documented |
313
+
314
+ ### Coverage Thresholds (Strict)
315
+
316
+ Coverage gaps are **CRITICAL blockers**, not warnings (per ADR-010):
317
+
318
+ | Layer | Threshold | Enforcement |
319
+ |-------|-----------|-------------|
320
+ | Business Logic | 95% | CRITICAL - blocks QA |
321
+ | Application | 85% | CRITICAL - blocks QA |
322
+ | Infrastructure | 80% | CRITICAL - blocks QA |
323
+
324
+ ---
325
+
326
+ ## Key Design Decisions
327
+
328
+ ### Markdown-First
329
+
330
+ All framework components (skills, subagents, commands, context files, ADRs) use Markdown with YAML frontmatter. Claude interprets natural language better than structured formats, with documented 60-80% token savings through progressive disclosure.
331
+
332
+ (Source: devforgeai/specs/context/tech-stack.md, lines 29-46)
333
+
334
+ ### Framework-Agnostic
335
+
336
+ DevForgeAI constrains its own implementation (Markdown, Git, Claude Code Terminal) but imposes no technology choices on projects. The `designing-systems` skill asks the user to select their stack and locks it in the project's own `tech-stack.md`.
337
+
338
+ (Source: devforgeai/specs/context/tech-stack.md, lines 7-9)
339
+
340
+ ### TDD Mandatory
341
+
342
+ Tests are written before implementation (Red-Green-Refactor). This is enforced structurally: Phase 02 (Red) must complete before Phase 03 (Green) can begin. Test integrity snapshots detect any tampering with tests after the Red phase.
343
+
344
+ ### Immutable Context Files
345
+
346
+ The 6 constitutional files cannot be edited directly. Changes require an ADR to be accepted first, then propagated via the `/create-context` workflow. This prevents ad-hoc constraint relaxation that leads to technical debt.
347
+
348
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 83-101)
349
+
350
+ ### Three-Layer Dependency Rules
351
+
352
+ Strict directional dependencies prevent circular coupling:
353
+
354
+ - Commands -> Skills -> Subagents (allowed)
355
+ - Subagents -> Skills (forbidden)
356
+ - Skills -> Commands (forbidden)
357
+ - Circular dependencies (forbidden)
358
+
359
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 19-26)
360
+
361
+ ### Parallel Execution Model
362
+
363
+ Subagents are stateless and isolated, enabling parallel dispatch (4-6 recommended, 10 max). No shared state between parallel tasks. Sequential execution is the fallback if parallel fails, with a 50% success threshold to continue.
364
+
365
+ (Source: devforgeai/specs/context/architecture-constraints.md, lines 155-186)
366
+
367
+ ### Native Tools Over Bash
368
+
369
+ Framework mandates Claude Code native tools (Read, Write, Edit, Glob, Grep) over Bash equivalents, achieving 40-73% token savings. Bash is reserved for test execution, builds, git operations, and package management.
370
+
371
+ (Source: devforgeai/specs/context/tech-stack.md, lines 246-258)
372
+
373
+ ---
374
+
375
+ ## Directory Structure (Abridged)
376
+
377
+ ```
378
+ DevForgeAI2/
379
+ +-- .claude/
380
+ | +-- agents/ # 44 subagent definitions (.md)
381
+ | +-- commands/ # Slash commands (.md)
382
+ | +-- hooks/ # Shell hooks + phase-steps-registry.json
383
+ | +-- memory/ # Runtime memory files
384
+ | +-- skills/ # 26 skills (SKILL.md + references/)
385
+ | +-- scripts/ # Python CLI (devforgeai-validate)
386
+ | +-- settings.json # Hook registration
387
+ +-- devforgeai/
388
+ | +-- specs/
389
+ | | +-- context/ # 6 constitutional files (IMMUTABLE)
390
+ | | +-- adrs/ # Architecture Decision Records
391
+ | | +-- Stories/ # Story files (.story.md)
392
+ | | +-- Epics/ # Epic files
393
+ | +-- workflows/ # Phase state JSON files
394
+ | +-- feedback/ # AI analysis reports
395
+ +-- src/ # Source implementations
396
+ +-- tests/ # Test files (write-protected)
397
+ +-- docs/ # Documentation output
398
+ ```
399
+
400
+ (Source: devforgeai/specs/context/source-tree.md, lines 17-27)
401
+
402
+ ---
403
+
404
+ <!-- SECTION: assessing-entrepreneur START -->
405
+ ## Assessing Entrepreneur
406
+
407
+ The assessing-entrepreneur skill guides solo developers and aspiring entrepreneurs through a 6-dimension self-assessment questionnaire. It produces a structured `user-profile.yaml` consumed by downstream coaching and planning workflows.
408
+
409
+ **Story:** STORY-465 (Guided Self-Assessment Skill)
410
+ **Epic:** EPIC-072
411
+
412
+ ### Components
413
+
414
+ | Component | Type | Path | Lines | Constraints |
415
+ |-----------|------|------|-------|-------------|
416
+ | `SKILL.md` | Skill (inline expansion) | `src/claude/skills/assessing-entrepreneur/SKILL.md` | ~196 | < 1000 lines |
417
+ | `entrepreneur-assessor.md` | Subagent | `src/claude/agents/entrepreneur-assessor.md` | ~128 | < 500 lines |
418
+ | `work-style-questionnaire.md` | Reference | `src/claude/skills/assessing-entrepreneur/references/` | ~270 | Loaded Phases 2-7 |
419
+ | `adhd-adaptation-framework.md` | Reference | `src/claude/skills/assessing-entrepreneur/references/` | ~95 | Loaded Phases 8-9 (conditional) |
420
+ | `confidence-assessment-workflow.md` | Reference | `src/claude/skills/assessing-entrepreneur/references/` | ~121 | Loaded Phases 8-9 (conditional) |
421
+ | `plan-calibration-engine.md` | Reference | `src/claude/skills/assessing-entrepreneur/references/` | ~132 | Loaded Phases 8-9 |
422
+
423
+ (Source: devforgeai/specs/Stories/archive/STORY-465-guided-self-assessment-skill.story.md, lines 393-406)
424
+
425
+ ### Data Flow
426
+
427
+ ```mermaid
428
+ flowchart LR
429
+ A["/assess-me Command"] --> B["Phase 1: Consent Disclaimer"]
430
+ B --> C["Phases 2-7: AskUserQuestion\n14 questions, 6 dimensions"]
431
+ C --> D["entrepreneur-assessor\nSubagent via Task()"]
432
+ D --> E["5-Step Normalization\nValidate - Normalize - Generate - Cross-Ref - Output"]
433
+ E --> F["devforgeai/specs/business/\nuser-profile.yaml"]
434
+ F --> G["Phase 9: Results Summary"]
435
+ F --> H["Downstream Consumers\ncoaching-entrepreneur, milestone-generator"]
436
+ ```
437
+
438
+ ### Assessment Dimensions
439
+
440
+ The questionnaire covers 6 dimensions with 14 total questions. All questions use AskUserQuestion with bounded options (2-7 choices per question). No free-text input.
441
+
442
+ | Dimension | Questions | Option Count | Multi-Select |
443
+ |-----------|-----------|-------------|--------------|
444
+ | Work Style | Q1.1 Daily Structure, Q1.2 Environment, Q1.3 Collaboration | 5, 5, 5 | No |
445
+ | Task Completion | Q2.1 Multi-Step Projects, Q2.2 Interruptions | 5, 5 | No |
446
+ | Motivation | Q3.1 Primary Drivers, Q3.2 Losing Motivation | 6, 6 | Yes |
447
+ | Energy Management | Q4.1 Peak Focus Time, Q4.2 Energy Recovery | 7, 6 | Q4.2: Yes |
448
+ | Previous Attempts | Q5.1 Experience Level, Q5.2 Lessons Learned | 5, 7 | Q5.2: Yes (conditional) |
449
+ | Self-Reported Challenges | Q6.1 Primary Challenges, Q6.2 Support Preferences | 8, 6 | Yes |
450
+
451
+ (Source: src/claude/skills/assessing-entrepreneur/references/work-style-questionnaire.md, lines 13-263)
452
+
453
+ ### Profile Output Schema
454
+
455
+ The entrepreneur-assessor subagent writes a 7-dimension adaptive profile to `devforgeai/specs/business/user-profile.yaml`:
456
+
457
+ ```yaml
458
+ adaptive_profile:
459
+ task_chunk_size: micro | standard | extended # 5-60 min per task
460
+ session_length: short | medium | long # 15-60 min per session
461
+ check_in_frequency: frequent | moderate | minimal # every 1-5 tasks
462
+ progress_visualization: per_task | daily | weekly
463
+ celebration_intensity: high | medium | low
464
+ reminder_style: specific | balanced | gentle
465
+ overwhelm_prevention: strict | moderate | open # next-3-tasks-only to full-roadmap
466
+ ```
467
+
468
+ (Source: src/claude/skills/assessing-entrepreneur/SKILL.md, lines 159-184)
469
+
470
+ ### Calibration Pipeline
471
+
472
+ The plan-calibration-engine maps 6 profile signals through a 4-area intermediate calibration to the 7-dimension adaptive profile:
473
+
474
+ ```mermaid
475
+ flowchart LR
476
+ subgraph "Profile Signals"
477
+ F[focus_level]
478
+ C[completion_pattern]
479
+ M[motivation_drivers]
480
+ CH[challenge_areas]
481
+ E[experience_level]
482
+ W[work_style]
483
+ end
484
+
485
+ subgraph "4-Area Calibration"
486
+ TG["Task Granularity\nmicro - large"]
487
+ TB["Timeline Buffer\n1.1x - 2.0x"]
488
+ CF["Check-in Frequency\ntwice-daily - weekly"]
489
+ CS["Coaching Style\npeer - adaptive"]
490
+ end
491
+
492
+ subgraph "7-Dimension Output"
493
+ D1[task_chunk_size]
494
+ D2[session_length]
495
+ D3[check_in_frequency]
496
+ D4[progress_visualization]
497
+ D5[celebration_intensity]
498
+ D6[reminder_style]
499
+ D7[overwhelm_prevention]
500
+ end
501
+
502
+ F --> TG
503
+ C --> TG
504
+ C --> TB
505
+ CH --> TB
506
+ C --> CF
507
+ E --> CF
508
+ E --> CS
509
+ M --> CS
510
+
511
+ TG --> D1
512
+ TG --> D2
513
+ CF --> D3
514
+ TG --> D4
515
+ M --> D5
516
+ CS --> D6
517
+ CH --> D7
518
+ ```
519
+
520
+ Cross-dimension adjustments apply after initial mapping: motivation drops with routine tasks combined with consistency challenges increase check-in frequency; failed previous attempts due to scope reduce task granularity by one level; variable energy patterns add flexibility buffers.
521
+
522
+ (Source: src/claude/skills/assessing-entrepreneur/references/plan-calibration-engine.md, lines 63-96)
523
+
524
+ ### Subagent: entrepreneur-assessor
525
+
526
+ | Property | Value |
527
+ |----------|-------|
528
+ | **Tools** | Read, Glob, Grep, AskUserQuestion |
529
+ | **Responsibility** | Response normalization only (no plan generation) |
530
+ | **Input** | Raw responses from 6 dimensions |
531
+ | **Output** | `user-profile.yaml` (sole authorized writer) |
532
+ | **AskUserQuestion usage** | Clarify ambiguous or missing responses only |
533
+
534
+ The subagent processes responses through 5 steps:
535
+
536
+ 1. **Validate** -- Ensure all 6 dimensions present; request missing via AskUserQuestion
537
+ 2. **Normalize** -- Categorical responses to profile tags, multi-select to weighted lists
538
+ 3. **Generate** -- Produce YAML profile with dimension-level adaptations
539
+ 4. **Cross-reference** -- Identify reinforcing or contradicting patterns across dimensions
540
+ 5. **Output** -- Write `user-profile.yaml` and return summary to the skill
541
+
542
+ (Source: src/claude/agents/entrepreneur-assessor.md, lines 37-109)
543
+
544
+ ### Integration Points
545
+
546
+ | Direction | Component | Mechanism | Constraint |
547
+ |-----------|-----------|-----------|------------|
548
+ | **Invoked by** | `/assess-me` command | `Skill(command="assessing-entrepreneur")` | Thin orchestrator |
549
+ | **Invoked by** | Business coaching workflows | Direct skill invocation | Optional pre-coaching step |
550
+ | **Writes to** | `devforgeai/specs/business/user-profile.yaml` | entrepreneur-assessor subagent | BR-001: sole writer |
551
+ | **Read by** | coaching-entrepreneur skill | `Read()` -- read-only | Never modifies profile |
552
+ | **Read by** | Plan calibration, milestone generator | `Read()` -- read-only | Downstream consumers |
553
+
554
+ ### Design Decisions
555
+
556
+ | Decision | Rationale |
557
+ |----------|-----------|
558
+ | Progressive disclosure (4 reference files) | Token efficiency; SKILL.md stays at 196 lines, deep content loaded on demand |
559
+ | Subagent for normalization | Single responsibility; SKILL.md orchestrates, entrepreneur-assessor transforms |
560
+ | AskUserQuestion for all input | Bounded options (2-7 per question) eliminate free-text parsing |
561
+ | 7-dimension enum profile | Discrete values consumable by any downstream workflow without parsing |
562
+ | Non-clinical framing | Ethical requirement; skill NEVER diagnoses mental health conditions |
563
+ | Gerund naming (`assessing-entrepreneur`) | Per ADR-017 skill naming convention |
564
+ | Sole writer rule (BR-001) | Prevents race conditions; entrepreneur-assessor is the only writer of `user-profile.yaml` |
565
+ <!-- SECTION: assessing-entrepreneur END -->
566
+
567
+ <!-- SECTION: coaching-entrepreneur START -->
568
+ ## Coaching Entrepreneur
569
+
570
+ The coaching-entrepreneur skill provides adaptive business coaching through dynamic persona blending. It shifts between Coach mode (empathetic, supportive, celebration-focused) and Consultant mode (structured, deliverable-oriented, framework-driven) based on user emotional state and readiness level. The skill reads user adaptation profiles from STORY-466 to calibrate coaching intensity, task granularity, and communication style. It also reads the session log from STORY-468 to adapt its opening tone based on the user's self-reported emotional state from the previous session.
571
+
572
+ **Stories:** STORY-467 (Dynamic Persona Blend Engine), STORY-468 (Emotional State Tracking)
573
+ **Epic:** EPIC-072
574
+ **Depends on:** STORY-466 (Adaptive Profile Generation), STORY-467 (Dynamic Persona Blend Engine)
575
+
576
+ ### Components
577
+
578
+ | Component | Type | Path | Lines | Constraints |
579
+ |-----------|------|------|-------|-------------|
580
+ | `SKILL.md` | Skill (inline expansion) | `src/claude/skills/coaching-entrepreneur/SKILL.md` | target ≤1000 | < 1000 lines |
581
+ | `business-coach.md` | Subagent | `src/claude/agents/business-coach.md` | target ≤500 | < 500 lines, Read/Grep/Glob/AskUserQuestion only |
582
+
583
+ (Source: devforgeai/specs/Stories/archive/STORY-467-dynamic-persona-blend-engine.story.md, lines 52-100)
584
+
585
+ ### Data Flow
586
+ ```mermaid
587
+ flowchart LR
588
+ A["Coaching Command"] --> B["Phase 1: Init & Profile Loading"]
589
+ B --> C["business-coach Subagent<br/>via Task()"]
590
+ C --> D["Persona Detection<br/>Assess user state via AskUserQuestion"]
591
+ D --> E["Calibration<br/>Apply profile to persona blend"]
592
+ E --> F["Coaching Delivery<br/>Coach or Consultant mode"]
593
+ F --> G["User Interaction<br/>AskUserQuestion feedback loop"]
594
+ B -.->|Read-only| H["devforgeai/specs/business/<br/>user-profile.yaml"]
595
+ ```
596
+
597
+ ### Persona Architecture
598
+
599
+ | Dimension | Coach Mode | Consultant Mode |
600
+ |-----------|-----------|-----------------|
601
+ | **Language** | Empathetic, encouraging, personal | Professional, framework-driven, structured |
602
+ | **Celebration** | Celebrates every win, emphasizes effort | Acknowledges progress, focuses on outputs |
603
+ | **Self-Doubt** | Directly addresses confidence gaps | Reframes as problem-solving opportunities |
604
+ | **Trigger Conditions** | Low energy, early stage, first attempt | High focus, clear direction, experienced |
605
+
606
+ (Source: devforgeai/specs/Stories/archive/STORY-467-dynamic-persona-blend-engine.story.md, lines 72-75)
607
+
608
+ ### Business Rules
609
+
610
+ | Rule | Constraint | Enforcement |
611
+ |------|-----------|-------------|
612
+ | **BR-001** | Coach mode uses empathetic language; Consultant mode uses structured language | Both personas defined with explicit language guides in SKILL.md |
613
+ | **BR-002** | Coaching skill reads user-profile.yaml but NEVER writes to it | No Write() calls; read-only Read() only |
614
+ | **BR-003** | Default to Coach mode if profile unavailable | Graceful fallback without profile |
615
+ | **BR-EST-001** | Emotional state is self-reported only — the AI never infers emotional state | AskUserQuestion used for all emotional state collection; no inference logic permitted |
616
+ | **BR-EST-002** | User overrides are respected immediately within the same session and logged for future reference | Override detected via AskUserQuestion response; tone switches without delay; override field written to session-log.yaml |
617
+
618
+ ### Integration Points
619
+
620
+ | Direction | Component | Mechanism | Constraint |
621
+ |-----------|-----------|-----------|------------|
622
+ | **Invoked by** | Coaching commands | `Skill(command="coaching-entrepreneur")` | Thin orchestrator |
623
+ | **Reads from** | User profile | `Read("devforgeai/specs/business/user-profile.yaml")` | Optional (defaults gracefully) |
624
+ | **Reads from** | Session log | `Read("devforgeai/specs/business/coaching/session-log.yaml")` | Optional; absent on first session |
625
+ | **Writes to** | Session log | `Write("devforgeai/specs/business/coaching/session-log.yaml")` | Appends one entry per completed session |
626
+ | **Uses subagent** | business-coach | `Task(subagent_type="business-coach")` | Isolated coaching context |
627
+ | **Depends on** | STORY-466 profile | Profile creation via `/assess-me` command | Upstream dependency |
628
+ | **Depends on** | STORY-467 persona engine | Dynamic persona blend logic | Upstream dependency |
629
+
630
+ ---
631
+
632
+ ### Emotional State Tracking (STORY-468)
633
+
634
+ #### Session Log Data Model
635
+
636
+ **File path:** `devforgeai/specs/business/coaching/session-log.yaml`
637
+
638
+ ```yaml
639
+ sessions:
640
+ - date: "2026-03-01T10:14:00Z"
641
+ emotional_state: frustrated
642
+ override: null
643
+ - date: "2026-03-03T09:02:00Z"
644
+ emotional_state: energized
645
+ override: "Actually feeling tired today, let's keep it light"
646
+ ```
647
+
648
+ | Field | Type | Required | Enum / Notes |
649
+ |-------|------|----------|--------------|
650
+ | `sessions` | Array | Yes | One entry per completed session; chronological order |
651
+ | `sessions[].date` | DateTime | Yes | ISO 8601 UTC timestamp of session start |
652
+ | `sessions[].emotional_state` | String | Yes | `energized` \| `focused` \| `neutral` \| `tired` \| `frustrated` \| `anxious` \| `overwhelmed` |
653
+ | `sessions[].override` | String | No | Verbatim user override text; `null` when no override occurred |
654
+
655
+ #### Emotional State Check-in Flow
656
+
657
+ ```mermaid
658
+ flowchart TD
659
+ A["Session Start"] --> B{"session-log.yaml<br/>exists?"}
660
+ B -- No --> C["First-time user path<br/>No tone adaptation"]
661
+ B -- Yes --> D["Read last session entry<br/>emotional_state + override"]
662
+ D --> E["Compose opening tone<br/>based on previous state"]
663
+ E --> F["AskUserQuestion:<br/>How are you feeling today?"]
664
+ C --> F
665
+ F -- State selected --> G["Log emotional_state to current entry<br/>Proceed with adapted tone"]
666
+ F -- Skipped --> H["Default to neutral<br/>Proceed with neutral tone"]
667
+ G --> I["Coaching Session"]
668
+ H --> I
669
+ I --> J{"User override<br/>detected?"}
670
+ J -- Yes --> K["Switch tone immediately<br/>Log override field in current entry"]
671
+ J -- No --> L["Session Completes"]
672
+ K --> L
673
+ L --> M["Append session entry<br/>to session-log.yaml"]
674
+ ```
675
+
676
+ #### Tone Adaptation Examples
677
+
678
+ | Previous `emotional_state` | Opening Tone | Example Opening Line |
679
+ |---------------------------|--------------|----------------------|
680
+ | `energized` | Momentum-building | "You were on fire last time — ready to keep that momentum going?" |
681
+ | `focused` | Continuity | "Last session you were locked in. Let's build on that focus." |
682
+ | `neutral` | Standard | "Welcome back. Where would you like to pick up today?" |
683
+ | `tired` | Lighter, supportive | "Last session you were running low. No pressure today." |
684
+ | `frustrated` | Lighter, empathetic | "Last session felt tough. Let's start somewhere achievable." |
685
+ | `anxious` | Grounding, reassuring | "Things felt uncertain last time. Let's slow down and find solid ground." |
686
+ | `overwhelmed` | Minimal, one thing only | "Last session was a lot. Today we find one thing and only one thing." |
687
+
688
+ #### Design Decisions (STORY-468)
689
+
690
+ | Decision | Rationale |
691
+ |----------|-----------|
692
+ | Self-reported state only | AI inference of emotional/mental state raises ethical concerns; explicit reporting preserves user trust |
693
+ | Bounded enum over free text | Seven discrete states produce consistent tone mappings |
694
+ | Default to `neutral` on skip | Graceful degradation; avoids forcing disclosure |
695
+ | Override logged verbatim | Preserves user's exact words for future sessions |
696
+ | File persistence over memory | YAML file survives context window clears and Claude Code restarts (NFR-001) |
697
+ | Append-only session entries | Historical record enables future trend awareness without rewriting past data |
698
+
699
+ ---
700
+
701
+ ### Design Decisions (Skill-Wide)
702
+
703
+ | Decision | Rationale |
704
+ |----------|-----------|
705
+ | Two distinct personas | Some users need encouragement (Coach); others need structure (Consultant); adaptive blend serves both |
706
+ | Subagent for detection | Business logic isolated from SKILL.md orchestration; single responsibility |
707
+ | Profile read-only in coaching | Assessment skill is sole writer (BR-001); prevents data coordination bugs |
708
+ | Graceful fallback if profile missing | New users can start coaching before assessment; Coach mode is safer default |
709
+ | AskUserQuestion for all input | Bounded options eliminate free-text parsing; aligns with assessing-entrepreneur pattern |
710
+ | Session log written by coaching skill | Assessment skill owns user-profile.yaml; coaching skill owns session-log.yaml — clear write ownership per file |
711
+ <!-- SECTION: coaching-entrepreneur END -->
712
+
713
+ ---
714
+
715
+ ## References
716
+
717
+ - **Tech Stack**: `devforgeai/specs/context/tech-stack.md`
718
+ - **Architecture Constraints**: `devforgeai/specs/context/architecture-constraints.md`
719
+ - **Source Tree**: `devforgeai/specs/context/source-tree.md`
720
+ - **Phase Steps Registry**: `.claude/hooks/phase-steps-registry.json`
721
+ - **Hook README**: `.claude/hooks/README.md`
722
+ - **Quality Gates**: `.claude/rules/core/quality-gates.md`
723
+ - **Story Lifecycle**: `.claude/rules/workflow/story-lifecycle.md`
724
+ - **TDD Workflow**: `.claude/rules/workflow/tdd-workflow.md`