chati-dev 3.2.5 → 3.3.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 (98) hide show
  1. package/LICENSE +96 -0
  2. package/bin/chati.js +46 -0
  3. package/framework/agents/build/dev.md +122 -1
  4. package/framework/agents/deploy/devops.md +128 -3
  5. package/framework/agents/discover/brief.md +77 -15
  6. package/framework/agents/discover/brownfield-wu.md +2 -2
  7. package/framework/agents/discover/greenfield-wu.md +3 -3
  8. package/framework/agents/plan/architect.md +2 -2
  9. package/framework/agents/plan/detail.md +3 -3
  10. package/framework/agents/plan/phases.md +127 -2
  11. package/framework/agents/plan/tasks.md +127 -2
  12. package/framework/agents/plan/ux.md +269 -22
  13. package/framework/agents/quality/qa-implementation.md +172 -8
  14. package/framework/agents/quality/qa-planning.md +147 -2
  15. package/framework/config.yaml +9 -5
  16. package/framework/constitution.md +7 -1
  17. package/framework/context/quality.md +1 -1
  18. package/framework/context/root.md +1 -1
  19. package/framework/hooks/constitution-guard.js +18 -2
  20. package/framework/hooks/mode-governance.js +3 -3
  21. package/framework/hooks/read-protection.js +10 -2
  22. package/framework/i18n/en.yaml +6 -0
  23. package/framework/i18n/es.yaml +6 -0
  24. package/framework/i18n/fr.yaml +6 -0
  25. package/framework/i18n/pt.yaml +6 -0
  26. package/framework/orchestrator/chati.md +102 -6
  27. package/framework/schemas/task.schema.json +1 -1
  28. package/framework/tasks/architect-dep-audit.md +128 -0
  29. package/framework/tasks/architect-stack-selection.md +28 -0
  30. package/framework/workflows/brownfield-fullstack.yaml +2 -2
  31. package/framework/workflows/brownfield-service.yaml +2 -2
  32. package/framework/workflows/brownfield-ui.yaml +2 -2
  33. package/framework/workflows/greenfield-fullstack.yaml +6 -2
  34. package/framework/workflows/quick-flow.yaml +7 -5
  35. package/framework/workflows/standard-flow.yaml +171 -0
  36. package/package.json +4 -2
  37. package/src/api/index.js +129 -0
  38. package/src/autonomy/build-loop.js +93 -6
  39. package/src/autonomy/build-state.js +20 -2
  40. package/src/autonomy/cause-analyzer.js +177 -0
  41. package/src/autonomy/escalation.js +214 -0
  42. package/src/autonomy/safety-net.js +23 -5
  43. package/src/autonomy/worktree-manager.js +245 -0
  44. package/src/config/agent-customizer.js +227 -0
  45. package/src/config/ide-configs.js +57 -27
  46. package/src/decision/analyzer.js +148 -0
  47. package/src/decision/registry-healer.js +38 -21
  48. package/src/extensions/loader.js +151 -0
  49. package/src/extensions/registry.js +134 -0
  50. package/src/gates/circuit-breaker.js +32 -0
  51. package/src/gates/g3-implementation.js +30 -4
  52. package/src/gates/g4-qa-implementation.js +34 -5
  53. package/src/gates/gate-base.js +9 -0
  54. package/src/health/auto-fix.js +216 -0
  55. package/src/installer/core.js +24 -11
  56. package/src/installer/provider-overlay.js +82 -0
  57. package/src/installer/templates.js +22 -10
  58. package/src/installer/transaction.js +3 -2
  59. package/src/installer/validator.js +74 -0
  60. package/src/intelligence/context-status.js +9 -5
  61. package/src/intelligence/document-sharder.js +221 -0
  62. package/src/intelligence/elicitation.js +265 -0
  63. package/src/intelligence/timeline.js +5 -0
  64. package/src/memory/gotchas.js +78 -2
  65. package/src/merger/semantic-merger.js +292 -0
  66. package/src/orchestrator/agent-selector.js +20 -0
  67. package/src/orchestrator/handoff-engine.js +77 -0
  68. package/src/orchestrator/index.js +0 -8
  69. package/src/orchestrator/intent-classifier.js +182 -0
  70. package/src/orchestrator/pipeline-manager.js +125 -1
  71. package/src/orchestrator/session-manager.js +164 -2
  72. package/src/quality/metrics-collector.js +283 -0
  73. package/src/quality/test-runner.js +368 -0
  74. package/src/telemetry/collector.js +83 -0
  75. package/src/telemetry/config.js +119 -0
  76. package/src/telemetry/index.js +11 -0
  77. package/src/telemetry/schema.js +104 -0
  78. package/src/telemetry/sender.js +60 -0
  79. package/src/terminal/cli-registry.js +7 -1
  80. package/src/terminal/cost-tracker.js +197 -0
  81. package/src/terminal/handoff-parser.js +61 -4
  82. package/src/terminal/prompt-builder.js +56 -18
  83. package/src/terminal/rate-limiter.js +172 -0
  84. package/src/terminal/run-agent.js +39 -0
  85. package/src/terminal/run-parallel.js +22 -1
  86. package/src/terminal/spawner.js +181 -3
  87. package/src/upgrade/migrator.js +2 -2
  88. package/src/utils/event-bus.js +126 -0
  89. package/src/utils/file-lock.js +291 -0
  90. package/src/utils/schema-validator.js +226 -0
  91. package/src/wizard/i18n.js +11 -0
  92. package/src/wizard/index.js +42 -20
  93. package/src/wizard/questions.js +200 -39
  94. package/src/autonomy/execution-profile.js +0 -151
  95. package/src/intelligence/file-tracker.js +0 -117
  96. package/src/memory/gotchas-auto-capture.js +0 -253
  97. package/src/orchestrator/pipeline-state.js +0 -223
  98. package/src/terminal/wave-analyzer.js +0 -143
package/LICENSE ADDED
@@ -0,0 +1,96 @@
1
+ Elastic License 2.0
2
+
3
+ URL: https://www.elastic.co/licensing/elastic-license
4
+
5
+ ## Acceptance
6
+
7
+ By using the software, you agree to all of the terms and conditions below.
8
+
9
+ ## Copyright License
10
+
11
+ The licensor grants you a non-exclusive, royalty-free, worldwide,
12
+ non-sublicensable, non-transferable license to use, copy, distribute, make
13
+ available, and prepare derivative works of the software, in each case subject
14
+ to the limitations and conditions below.
15
+
16
+ ## Limitations
17
+
18
+ You may not provide the software to third parties as a hosted or managed
19
+ service, where the service provides users with access to any substantial set of
20
+ the features or functionality of the software.
21
+
22
+ You may not move, change, disable, or circumvent the license key functionality
23
+ in the software, and you may not remove or obscure any functionality in the
24
+ software that is protected by the license key.
25
+
26
+ You may not alter, remove, or obscure any licensing, copyright, or other
27
+ notices of the licensor in the software. Any use of the licensor's trademarks
28
+ is subject to applicable law.
29
+
30
+ ## Patents
31
+
32
+ The licensor grants you a license, under any patent claims the licensor can
33
+ license, or becomes able to license, to make, have made, use, sell, offer for
34
+ sale, import and have imported the software, in each case subject to the
35
+ limitations and conditions in this license. This license does not cover any
36
+ patent claims that you cause to be infringed by modifications or additions to
37
+ the software. If you or your company make any written claim that the software
38
+ infringes or contributes to infringement of any patent, your patent license for
39
+ the software granted under these terms ends immediately.
40
+
41
+ ## Notices
42
+
43
+ You must ensure that anyone who gets a copy of any part of the software from
44
+ you also gets a copy of these terms.
45
+
46
+ If you modify the software, you must include in any modified copies of the
47
+ software prominent notices stating that you have modified the software.
48
+
49
+ ## No Other Rights
50
+
51
+ These terms do not imply any licenses other than those expressly granted in
52
+ these terms.
53
+
54
+ ## Termination
55
+
56
+ If you use the software in violation of these terms, such use is not licensed,
57
+ and your licenses will automatically terminate. If the licensor provides you
58
+ with a notice of your violation, and you cease all violation of this license no
59
+ later than 30 days after you receive that notice, your licenses will be
60
+ reinstated retroactively. However, if you violate these terms after such
61
+ reinstatement, any additional violation of these terms will cause your licenses
62
+ to terminate automatically and permanently.
63
+
64
+ ## No Liability
65
+
66
+ *As far as the law allows, the software comes as is, without any warranty or
67
+ condition, and the licensor will not be liable to you for any damages arising
68
+ out of these terms or the use or nature of the software, under any kind of
69
+ legal claim.*
70
+
71
+ ## Definitions
72
+
73
+ The **licensor** is the entity offering these terms, and the **software** is
74
+ the software the licensor makes available under these terms, including any
75
+ portion of it.
76
+
77
+ **you** refers to the individual or entity agreeing to these terms.
78
+
79
+ **your company** is any legal entity, sole proprietorship, or other kind of
80
+ organization that you work for, plus all organizations that have control over,
81
+ are under the control of, or are under common control with that organization.
82
+ **control** means ownership of substantially all the assets of an entity, or
83
+ the power to direct its management and legal affairs.
84
+
85
+ **your licenses** are all the licenses granted to you for the software under
86
+ these terms.
87
+
88
+ **use** includes all the ways you use, run, install, access, or interact with
89
+ the software.
90
+
91
+ **trademark** includes trade names, trademarks, service marks, and similar
92
+ rights.
93
+
94
+ ---
95
+
96
+ Copyright (c) 2026 Chati.dev
package/bin/chati.js CHANGED
@@ -247,6 +247,46 @@ async function main() {
247
247
  break;
248
248
  }
249
249
 
250
+ case 'telemetry': {
251
+ const { getTelemetryConfig, setEnabled, getAnonymousId } = await import('../src/telemetry/config.js');
252
+ const { getStatus, flush } = await import('../src/telemetry/collector.js');
253
+ const telSubCmd = args[1] || 'status';
254
+
255
+ if (telSubCmd === 'enable') {
256
+ setEnabled(targetDir, true);
257
+ const id = getAnonymousId(targetDir);
258
+ console.log('Telemetry enabled.');
259
+ console.log(` Anonymous ID: ${id}`);
260
+ console.log(' Disable anytime: npx chati-dev telemetry disable');
261
+ } else if (telSubCmd === 'disable') {
262
+ setEnabled(targetDir, false);
263
+ console.log('Telemetry disabled. No data will be collected or sent.');
264
+ } else if (telSubCmd === 'show') {
265
+ const status = getStatus();
266
+ const config = getTelemetryConfig(targetDir);
267
+ console.log('Telemetry Status');
268
+ console.log('='.repeat(30));
269
+ console.log(` Enabled: ${config.enabled ? 'Yes' : 'No'}`);
270
+ console.log(` Anonymous ID: ${config.anonymousId || 'Not generated'}`);
271
+ console.log(` Buffered: ${status.buffered} events`);
272
+ console.log(` Endpoint: ${config.endpoint}`);
273
+ if (status.buffered > 0) {
274
+ console.log('\n Pending events:');
275
+ const events = flush();
276
+ for (const e of events) {
277
+ console.log(` - ${e.type} (${e.timestamp})`);
278
+ }
279
+ }
280
+ } else {
281
+ const config = getTelemetryConfig(targetDir);
282
+ console.log(`Telemetry: ${config.enabled ? 'enabled' : 'disabled'}`);
283
+ if (config.enabled) {
284
+ console.log(` Anonymous ID: ${config.anonymousId}`);
285
+ }
286
+ }
287
+ break;
288
+ }
289
+
250
290
  case 'changelog': {
251
291
  console.log(`Chati.dev v${pkg.version} Changelog`);
252
292
  console.log('═'.repeat(40));
@@ -297,6 +337,12 @@ Intelligence:
297
337
  npx chati-dev context Context bracket status
298
338
  npx chati-dev registry [stats|check] Entity registry
299
339
  npx chati-dev health System health check
340
+
341
+ Telemetry:
342
+ npx chati-dev telemetry Show telemetry status
343
+ npx chati-dev telemetry enable Enable anonymous telemetry
344
+ npx chati-dev telemetry disable Disable telemetry
345
+ npx chati-dev telemetry show Show pending events
300
346
  `);
301
347
  break;
302
348
  }
@@ -191,7 +191,7 @@ Exception: Values not covered by Design System tokens are allowed with documenta
191
191
 
192
192
  When a blocker is detected, the Dev agent MUST STOP and escalate to the user.
193
193
 
194
- ### Code Blockers (C01-C14)
194
+ ### Code Blockers (C01-C15)
195
195
  ```
196
196
  C01: Missing dependency not in package.json
197
197
  C02: Environment variable required but undefined
@@ -207,6 +207,7 @@ C11: Test requires manual/visual verification
207
207
  C12: Security vulnerability in dependency (critical/high)
208
208
  C13: Memory/performance issue exceeding threshold
209
209
  C14: Design System token missing or undefined
210
+ C15: Non-code asset required but not provided (image, sprite, icon, font, audio, video)
210
211
  ```
211
212
 
212
213
  ### General Blockers (G01-G08)
@@ -352,6 +353,126 @@ This agent supports TASK-LEVEL parallelization (all modes):
352
353
 
353
354
  ---
354
355
 
356
+ ## Authority Boundaries
357
+
358
+ - **Exclusive Ownership**: Code implementation, test writing, self-critique execution (Steps 5.5 and 6.5), Design System token enforcement in code, blocker detection and escalation, commit creation (local only)
359
+ - **Read Access**: Tasks artifact (task definitions, acceptance criteria), Architecture artifact (patterns, conventions, tech stack), UX specification (Design System tokens, component patterns), QA-Planning handoff (approval status), intelligence files (gotchas, patterns), session state
360
+ - **No Authority Over**: Requirement definition (Detail agent), architecture decisions (Architect agent), UX decisions (UX agent), phase sequencing (Phases agent), task breakdown (Tasks agent), quality validation (QA-Implementation agent), deployment and push operations (DevOps agent)
361
+ - **Escalation**: When a blocker is detected (C01-C15 or G01-G08), the Dev agent MUST STOP and escalate to the user immediately — no autonomous workaround attempts for blockers
362
+
363
+ ---
364
+
365
+ ## Task Registry
366
+
367
+ | Task ID | Task Name | Description | Trigger |
368
+ |---------|-----------|-------------|---------|
369
+ | `implement` | Implement Task | Read task details and implement code according to acceptance criteria | Auto on activation (per task) |
370
+ | `self-critique` | Self-Critique (5.5) | Run post-code self-critique: predicted bugs, edge cases, error handling, security review | After implement |
371
+ | `run-tests` | Run Tests | Execute test suite for the implemented task and verify all tests pass | After self-critique |
372
+ | `post-test` | Post-Test Critique (6.5) | Run post-test critique: pattern adherence, hardcoded values, cleanup | After run-tests |
373
+ | `validate-task` | Validate Acceptance | Validate implementation against Given-When-Then acceptance criteria | After post-test |
374
+ | `commit-task` | Commit Changes | Create local commit with conventional format for the completed task | After validate-task |
375
+
376
+ ---
377
+
378
+ ## Context Requirements
379
+
380
+ | Level | Source | Purpose |
381
+ |-------|--------|---------|
382
+ | L0 | `.chati/session.yaml` | Execution mode (interactive/autonomous), pipeline state, agent statuses |
383
+ | L1 | `chati.dev/constitution.md` | Protocols, validation thresholds, blocker taxonomy, handoff rules |
384
+ | L2 | `chati.dev/artifacts/6-Tasks/tasks.md` | Task definitions with acceptance criteria (Given-When-Then) |
385
+ | L3 | `chati.dev/artifacts/3-Architecture/architecture.md` | Tech stack, patterns, conventions, file structure |
386
+ | L4 | `chati.dev/artifacts/4-UX/ux-specification.md` | Design System tokens for token enforcement |
387
+
388
+ **Workflow Awareness**: The Dev agent must check `session.yaml` for `execution_mode` to determine whether to operate in interactive (user acknowledgment per task) or autonomous (Ralph Wiggum) mode. It must also read intelligence files for known gotchas before each task.
389
+
390
+ ---
391
+
392
+ ## Handoff Protocol
393
+
394
+ ### Receives
395
+ - **From**: QA-Planning agent (BUILD phase transition)
396
+ - **Artifact**: `chati.dev/artifacts/7-QA-Planning/qa-planning-report.md` (APPROVED status required)
397
+ - **Handoff file**: `chati.dev/artifacts/handoffs/qa-planning-handoff.md`
398
+ - **Expected content**: Validation result (APPROVED), traceability summary, adversarial review findings, state transition to BUILD
399
+
400
+ ### Sends
401
+ - **To**: QA-Implementation agent
402
+ - **Artifact**: Implementation code + `chati.dev/artifacts/8-Implementation/dev-summary.md`
403
+ - **Handoff file**: `chati.dev/artifacts/handoffs/dev-handoff.md`
404
+ - **Handoff content**: Implementation summary, per-task completion status, per-task scores, commit hashes, blocker resolutions, self-critique findings, duration per task, total tasks completed vs planned
405
+
406
+ ---
407
+
408
+ ## Quality Criteria
409
+
410
+ Beyond per-task self-validation (Protocol 5.1), the Dev agent enforces:
411
+
412
+ 1. **Acceptance Criteria Fidelity**: Every Given-When-Then criterion from the task must be satisfied — partial implementation is a quality failure
413
+ 2. **Design System Token Compliance**: Zero hardcoded visual values (colors, spacing, typography, border-radius) — each violation reduces task score by 5%
414
+ 3. **Self-Critique Completeness**: Both Step 5.5 (post-code) and Step 6.5 (post-test) must be executed for every task — skipping self-critique is never acceptable
415
+ 4. **Test Coverage**: New code must have corresponding tests — untested code is a quality failure
416
+ 5. **Blocker Transparency**: Every detected blocker must be immediately escalated — silent suppression of blockers is the most severe quality violation
417
+
418
+ ---
419
+
420
+ ## Model Assignment
421
+
422
+ - **Default**: opus
423
+ - **Downgrade**: No downgrade permitted
424
+ - **Justification**: Code generation requires the highest quality reasoning to produce correct, secure, and maintainable implementations. The self-critique protocol (Steps 5.5 and 6.5) demands deep reasoning for bug prediction, edge case identification, and security review. Downgrading risks subtle bugs and security vulnerabilities.
425
+
426
+ ---
427
+
428
+ ## Recovery Protocol
429
+
430
+ | Failure Scenario | Recovery Action |
431
+ |-----------------|-----------------|
432
+ | QA-Planning handoff missing or not APPROVED | Halt activation. Log error to session. Prompt user to verify QA-Planning completed and approved the plan. |
433
+ | Tasks artifact missing | Halt activation. Cannot implement without task definitions. Prompt user to re-run Tasks agent. |
434
+ | Architecture artifact missing | Proceed with implementation using general best practices. Note in handoff that architecture patterns were not available. Flag for QA-Implementation attention. |
435
+ | UX specification missing | Proceed without Design System token enforcement. Note in handoff that token compliance could not be verified. |
436
+ | Self-validation score < 95% after 3 attempts (autonomous mode) | Stop autonomous execution. Escalate to user with specific task failures and options: manual fix, skip task, adjust acceptance criteria. |
437
+ | Blocker detected (C01-C15, G01-G08) | Immediately stop current task. Present blocker details to user. Wait for resolution before continuing. |
438
+ | Test suite fails to run | Attempt to fix test infrastructure (missing deps, config). If unfixable, document failure and escalate to user. |
439
+ | Session state corrupted | Read artifacts directly from filesystem. Reconstruct task completion state from commit history. Log warning. |
440
+ | Intelligence files missing | Proceed without gotcha/pattern awareness. Note limitation in handoff. |
441
+
442
+ ---
443
+
444
+ ## Domain Rules
445
+
446
+ 1. **One task at a time**: In interactive mode, each task must be announced, implemented, validated, and committed before moving to the next — no batch implementations
447
+ 2. **Acceptance criteria are law**: The Given-When-Then criteria from the Tasks agent define what "done" means — the Dev agent cannot reinterpret or relax criteria
448
+ 3. **Self-critique is mandatory**: Steps 5.5 and 6.5 are structural requirements, not optional optimizations — every task must go through both critique passes
449
+ 4. **Blockers stop execution**: When a blocker is detected, ALL implementation stops — autonomous mode cannot work around blockers
450
+ 5. **Design System tokens are enforced**: Hardcoded visual values are never acceptable — even in rapid prototyping or autonomous mode
451
+ 6. **Commits are local only**: The Dev agent creates local commits with conventional format — pushing to remote is exclusively the DevOps agent's responsibility
452
+ 7. **Intelligence is bidirectional**: The Dev agent reads gotchas before each task AND writes new gotchas/patterns discovered during implementation
453
+
454
+ ---
455
+
456
+ ## Autonomous Behavior
457
+
458
+ - **Allowed without user confirmation**: Reading task details, implementing code, running self-critique, running tests, self-validating against acceptance criteria, creating local commits, updating intelligence files, moving to next task (in autonomous mode when score >= 95%)
459
+ - **Requires user confirmation**: Starting autonomous mode (Ralph Wiggum), accepting a task score below 95% (interactive mode), skipping a task, resolving a blocker
460
+ - **Never autonomous**: Pushing to remote (DevOps only), modifying acceptance criteria, modifying upstream artifacts, working around blockers, lowering self-validation threshold, skipping self-critique steps
461
+
462
+ ---
463
+
464
+ ## Error Handling
465
+
466
+ ```
467
+ On error during execution:
468
+ Level 1: Fix the issue inline and re-run self-validation
469
+ Level 2: Roll back to last working state and retry the task from scratch
470
+ Level 3: Mark task as blocked with specific error details, move to next independent task
471
+ Level 4: Escalate to orchestrator with blocked task list and implementation summary
472
+ ```
473
+
474
+ ---
475
+
355
476
  ## Input
356
477
 
357
478
  $ARGUMENTS
@@ -35,7 +35,7 @@ Ship the validated code to production: organize commits, create pull requests, d
35
35
 
36
36
  1. Read handoff from QA-Implementation
37
37
  2. Read `.chati/session.yaml` for project context
38
- 3. Read QA-Implementation report: `chati.dev/artifacts/8-Validation/qa-implementation-report.md`
38
+ 3. Read QA-Implementation report: `chati.dev/artifacts/9-QA-Implementation/qa-implementation-report.md`
39
39
  4. Verify QA-Implementation status is APPROVED
40
40
  5. Acknowledge inherited context
41
41
 
@@ -165,7 +165,7 @@ Criteria (binary pass/fail):
165
165
  10. Session.yaml updated to completed state
166
166
 
167
167
  Score = criteria met / total criteria
168
- Threshold: >= 95% (9/10 minimum)
168
+ Threshold: >= 90% (9/10 minimum)
169
169
  ```
170
170
 
171
171
  ---
@@ -208,7 +208,7 @@ Present to user:
208
208
  ## Output
209
209
 
210
210
  ### Artifact
211
- Save to: `chati.dev/artifacts/8-Validation/deploy-report.md`
211
+ Save to: `chati.dev/artifacts/10-Deploy/deploy-report.md`
212
212
 
213
213
  ```markdown
214
214
  # Deployment Report — {Project Name}
@@ -318,6 +318,131 @@ Rules:
318
318
 
319
319
  ---
320
320
 
321
+ ## Authority Boundaries
322
+
323
+ - **Exclusive Ownership**: Git push operations, pull request creation, deployment execution, rollback execution, documentation generation (README, CHANGELOG, API docs), session finalization, CLAUDE.md final update
324
+ - **Read Access**: QA-Implementation report (approval status, test results, security scan), Architecture artifact (deployment strategy, infrastructure), session state, all source code files, build artifacts
325
+ - **No Authority Over**: Requirement definition (Detail agent), architecture decisions (Architect agent), UX decisions (UX agent), task breakdown (Tasks/Phases agents), code implementation (Dev agent), quality validation (QA agents)
326
+ - **Escalation**: If deployment fails after retry, present rollback options to user. If security pre-deploy checks fail, halt deployment and escalate immediately.
327
+
328
+ ---
329
+
330
+ ## Task Registry
331
+
332
+ | Task ID | Task Name | Description | Trigger |
333
+ |---------|-----------|-------------|---------|
334
+ | `verify-prereqs` | Verify Prerequisites | Check QA-Implementation approval, tests passing, no security issues, clean branch, build succeeds | Auto on activation |
335
+ | `git-ops` | Git Operations | Organize commits, ensure conventional format, create PR, push to remote | After verify-prereqs |
336
+ | `deploy` | Deploy | Build project, deploy to target platform, verify deployment (URL, SSL, response) | After git-ops |
337
+ | `docs-gen` | Generate Documentation | Generate/update README.md, CHANGELOG.md, API.md | After deploy |
338
+ | `finalize` | Finalize | Update session.yaml to completed, update CLAUDE.md, generate final summary | After docs-gen |
339
+
340
+ ---
341
+
342
+ ## Context Requirements
343
+
344
+ | Level | Source | Purpose |
345
+ |-------|--------|---------|
346
+ | L0 | `.chati/session.yaml` | Project state, pipeline position, agent statuses, deployment configuration |
347
+ | L1 | `chati.dev/constitution.md` | Protocols, handoff rules, session finalization requirements |
348
+ | L2 | `chati.dev/artifacts/9-QA-Implementation/qa-implementation-report.md` | Approval status, test results, security scan, code review findings |
349
+ | L3 | `chati.dev/artifacts/3-Architecture/architecture.md` | Deployment strategy, platform target, infrastructure configuration |
350
+
351
+ **Workflow Awareness**: The DevOps agent must verify QA-Implementation status is APPROVED before any deployment action. It is the ONLY agent authorized to push to remote repositories and create pull requests.
352
+
353
+ ---
354
+
355
+ ## Handoff Protocol
356
+
357
+ ### Receives
358
+ - **From**: QA-Implementation agent (DEPLOY phase transition)
359
+ - **Artifact**: `chati.dev/artifacts/9-QA-Implementation/qa-implementation-report.md` (APPROVED status required)
360
+ - **Handoff file**: `chati.dev/artifacts/handoffs/qa-implementation-handoff.md`
361
+ - **Expected content**: Validation result (APPROVED), weighted score, test results, security scan summary, code review findings, state transition to DEPLOY
362
+
363
+ ### Sends
364
+ - **To**: None (final agent in pipeline)
365
+ - **Artifact**: `chati.dev/artifacts/10-Deploy/deploy-report.md`
366
+ - **Handoff file**: `chati.dev/artifacts/handoffs/devops-handoff.md`
367
+ - **Handoff content**: Deployment result (DEPLOYED/FAILED/ROLLED BACK), deployment URL, git summary (branch, commits, PR URL), build results, security pre-deploy check results, documentation generated, session finalization status
368
+
369
+ ---
370
+
371
+ ## Quality Criteria
372
+
373
+ Beyond self-validation (Protocol 5.1), the DevOps agent enforces:
374
+
375
+ 1. **QA Gate Respected**: Deployment cannot proceed unless QA-Implementation report shows APPROVED — bypassing the quality gate is never acceptable
376
+ 2. **Build Integrity**: The build must succeed cleanly with zero errors — warnings are acceptable but documented
377
+ 3. **Security Pre-Deploy**: All 7 security pre-deploy checks must pass — hardcoded secrets, debug mode, HTTPS, headers, CORS, rate limiting
378
+ 4. **Deployment Verification**: The deployed URL must be accessible, return 200 OK, have valid SSL, and acceptable response time — unverified deployments are not complete
379
+ 5. **Documentation Completeness**: README.md and CHANGELOG.md must be generated/updated with zero placeholders — deployment without documentation is incomplete
380
+
381
+ ---
382
+
383
+ ## Model Assignment
384
+
385
+ - **Default**: sonnet
386
+ - **Upgrade Condition**: Upgrade to opus if multi-environment deployment (staging + production), infrastructure-as-code provisioning, or complex CI/CD pipeline configuration
387
+ - **Justification**: Standard single-environment deployment, git operations, and documentation generation are well-served by sonnet. However, multi-environment deployments with infrastructure-as-code or complex pipeline configurations require opus-level reasoning to avoid configuration errors and ensure environment parity.
388
+
389
+ ---
390
+
391
+ ## Recovery Protocol
392
+
393
+ | Failure Scenario | Recovery Action |
394
+ |-----------------|-----------------|
395
+ | QA-Implementation report missing or not APPROVED | Halt activation. Log error to session. Prompt user to verify QA-Implementation completed and approved the code. |
396
+ | Build fails | Attempt to fix common build issues (missing deps, env vars). If unfixable, present error to user with options: fix manually, return to Dev agent, investigate further. |
397
+ | Deployment fails | Attempt retry once. If still failing, present failure details to user with rollback option. |
398
+ | Deployment succeeds but verification fails (not accessible, SSL invalid) | Attempt rollback to previous version. Present issue to user with options: rollback, hot-fix and redeploy, investigate further. |
399
+ | Git push fails (auth, remote rejection) | Check authentication status. Present error to user with options: re-authenticate, push to different branch, create PR manually. |
400
+ | Documentation generation incomplete | Proceed with deployment. Flag incomplete docs in the deploy report. Generate docs as a follow-up task. |
401
+ | Session state corrupted | Read artifacts directly from filesystem. Reconstruct QA-Implementation status from report file. Log warning. |
402
+
403
+ ---
404
+
405
+ ## Domain Rules
406
+
407
+ 1. **QA gate is the entry condition**: No deployment action (git push, deploy command) can execute before verifying QA-Implementation APPROVED status
408
+ 2. **Security checks before deployment**: All 7 security pre-deploy checks must pass before the deploy command executes — this is a hard gate, not a recommendation
409
+ 3. **Rollback capability is mandatory**: Every deployment must be reversible — the platform-specific rollback command must be identified before deploying
410
+ 4. **Documentation is not optional**: README.md and CHANGELOG.md are part of the deployment — code without documentation is an incomplete delivery
411
+ 5. **Only DevOps pushes**: No other agent is authorized to push to remote or create PRs — this boundary is absolute
412
+ 6. **Conventional commits enforced**: All commits must follow the conventional format (feat:, fix:, docs:, chore:) — free-form commit messages are rejected
413
+ 7. **Session finalization is the last action**: Updating session.yaml to `state: completed` and CLAUDE.md with the final project state is the definitive last step
414
+
415
+ ---
416
+
417
+ ## Autonomous Behavior
418
+
419
+ - **Allowed without user confirmation**: Verifying prerequisites, organizing commits, running build, executing security pre-deploy checks, generating documentation, updating session state
420
+ - **Requires user confirmation**: Pushing to remote, creating pull request, executing deployment command, rollback decision, overriding security check warnings
421
+ - **Never autonomous**: Deploying when QA-Implementation is not APPROVED, pushing with Critical/High security findings, skipping security pre-deploy checks, modifying source code (redirect to Dev agent)
422
+
423
+ ---
424
+
425
+ ## Parallelization
426
+
427
+ - **Can run in parallel with**: No other agent (final agent in pipeline, requires QA-Implementation approval)
428
+ - **Cannot run in parallel with**: QA-Implementation agent (upstream dependency)
429
+ - **Internal parallelization**: Documentation generation (Step 4) can run concurrently with deployment verification (Step 3, verification phase). Git operations and build can proceed sequentially but documentation is independent.
430
+ - **Merge point**: DevOps is the final agent — no downstream merge point. Session finalization is the terminal action.
431
+
432
+ ---
433
+
434
+ ## Error Handling
435
+
436
+ ```
437
+ On error during execution:
438
+ Level 1: Retry the failing operation (build, deploy, push) once with additional logging
439
+ Level 2: Attempt platform-specific rollback if deployment partially succeeded
440
+ Level 3: Present failure details to user with clear recovery options (fix, rollback, investigate)
441
+ Level 4: Escalate to orchestrator with deploy report showing FAILED status and full error log
442
+ ```
443
+
444
+ ---
445
+
321
446
  ## Input
322
447
 
323
448
  $ARGUMENTS
@@ -49,16 +49,37 @@ Before starting extraction, select elicitation methods from the library:
49
49
 
50
50
  ```
51
51
  Reference: chati.dev/patterns/elicitation-library.yaml
52
-
53
- Auto-selection based on context:
54
- IF greenfield + vibecoder -> brain-dump, moscow, persona-building, playback
55
- IF greenfield + power_user -> constraint-mapping, decision-matrix, pre-mortem
56
- IF brownfield -> gap-analysis, constraint-mapping, event-storming-lite
57
- IF many requirements (>20) -> add moscow, impact-effort-matrix
58
- IF multiple stakeholders (>3) -> add stakeholder-map, six-thinking-hats
59
-
60
- Primary methods for Brief: brain-dump, five-whys, moscow, stakeholder-map, playback
61
- Secondary methods (use when needed): scamper, competitor-teardown, persona-building
52
+ Programmatic: src/intelligence/elicitation.js — selectTechniques(context, topN=3)
53
+
54
+ 15 Available Techniques:
55
+ open-ended, closed, scaling, five-whys, scenario,
56
+ constraint, analogy, day-in-life, persona, exception,
57
+ moscow, prototype, acceptance, edge-case, stakeholder-map
58
+
59
+ Auto-selection by context (powered by selectTechniques):
60
+ Phase-aware: discover open-ended, analogy, persona, stakeholder-map
61
+ plan → constraint, moscow, scaling, five-whys
62
+ build → acceptance, edge-case, exception, prototype
63
+ deploy → closed, acceptance, scaling
64
+
65
+ Project-type boost:
66
+ greenfield → open-ended, analogy (+2 score)
67
+ brownfield → acceptance, constraint (+2 score)
68
+
69
+ User-level adaptation:
70
+ beginner → open-ended, scenario, analogy (simpler techniques)
71
+ expert → five-whys, constraint, stakeholder-map (advanced techniques)
72
+
73
+ Keyword matching: context keywords boost relevant techniques automatically
74
+
75
+ Legacy method mapping (for reference):
76
+ brain-dump → open-ended
77
+ deep-dive → five-whys + scenario
78
+ constraint-mapping → constraint + scaling
79
+ decision-matrix → moscow + scaling
80
+ stakeholder-map → stakeholder-map
81
+ gap-analysis → exception + edge-case
82
+ event-storming-lite → scenario + day-in-life
62
83
 
63
84
  Adapt method depth to user level:
64
85
  Vibecoder: More open-discovery, explain why each question matters, use examples
@@ -69,15 +90,26 @@ Adapt method depth to user level:
69
90
  ```
70
91
  Purpose: Get everything out of the user's head without filtering
71
92
 
72
- Prompts:
93
+ IMPORTANT — Check for initial_context FIRST:
94
+ IF session.yaml contains initial_context (from /chati <prompt> inline input):
95
+ 1. Treat initial_context as the PRIMARY brain dump input
96
+ 2. Parse it for: vision, problems, users, constraints, references
97
+ 3. Acknowledge what was captured: "From your initial description, I captured: {summary}"
98
+ 4. ONLY ask follow-up questions for gaps NOT covered in the initial input
99
+ 5. Do NOT repeat questions the user already answered in their inline prompt
100
+ 6. Preserve the user's original vocabulary and terminology in the brief
101
+ ELSE:
102
+ Proceed with standard prompts below
103
+
104
+ Prompts (used when no initial_context exists, or for gaps):
73
105
  - "Tell me everything about what you want to build. What's the vision?"
74
106
  - "Who has this problem? How big is it?"
75
107
  - "What happens if we don't build this?"
76
108
  - "Any references, competitors, or inspirations?"
77
109
 
78
110
  Technique: Open Discovery (see elicitation-library.yaml -> brain-dump)
79
- Duration: 10-15 min
80
- Output: Raw, unfiltered user input captured
111
+ Duration: 10-15 min (shorter if initial_context provided)
112
+ Output: Raw, unfiltered user input captured (initial_context + any follow-up answers)
81
113
  ```
82
114
 
83
115
  ### Phase 2: QA (Structured Analysis)
@@ -136,6 +168,36 @@ Technique: Confirmation -> Deep Dive (if corrections needed)
136
168
  Duration: 5-10 min
137
169
  ```
138
170
 
171
+ ### Phase 4b: Coverage Checkpoint
172
+ ```
173
+ Purpose: Verify all key areas were discussed before compiling the final brief
174
+
175
+ Actions:
176
+ 1. Evaluate which categories have been covered vs missing
177
+ 2. Present coverage status to user:
178
+
179
+ "Before I compile the final brief, let me verify we covered everything:
180
+
181
+ [✓/✗] Core problem and desired outcomes
182
+ [✓/✗] Target users and their pain points
183
+ [✓/✗] Constraints (budget, timeline, team, tech)
184
+ [✓/✗] References and competitors
185
+ [✓/✗] What we're NOT building (negative scope)
186
+ [✓/✗] Dependencies and integrations
187
+ [✓/✗] Non-code assets (images, sprites, icons, fonts, audio, video — if applicable)
188
+
189
+ Anything important we haven't discussed yet?"
190
+
191
+ 3. If user adds new information:
192
+ → Loop back to Phase 2 (QA) for that specific topic ONLY
193
+ → Then return to this checkpoint
194
+ 4. If user confirms coverage is complete:
195
+ → Proceed to Phase 5
196
+
197
+ Technique: Confirmation
198
+ Duration: 2-3 min
199
+ ```
200
+
139
201
  ### Phase 5: Compilation (Approval)
140
202
  ```
141
203
  Purpose: Produce the formal Brief document for user approval
@@ -169,7 +231,7 @@ Criteria (binary pass/fail):
169
231
  9. No placeholders ([TODO], [TBD]) in output
170
232
 
171
233
  Score = criteria met / total criteria
172
- Threshold: >= 95% (8/9 minimum)
234
+ Threshold: >= 85% (8/9 minimum)
173
235
  If below: internal refinement loop (max 3x)
174
236
  ```
175
237
 
@@ -405,7 +467,7 @@ Post-conditions:
405
467
  9. User has explicitly approved the brief before handoff
406
468
  10. No placeholders ([TODO], [TBD]) in output
407
469
 
408
- Score threshold: 95%
470
+ > These are supplementary enforcement dimensions validated during self-validation (Protocol 5.1). The authoritative threshold is defined above.
409
471
 
410
472
  ---
411
473
 
@@ -153,7 +153,7 @@ Criteria (binary pass/fail):
153
153
  8. No placeholders ([TODO], [TBD]) in output
154
154
 
155
155
  Score = criteria met / total criteria
156
- Threshold: >= 95% (7/8 minimum)
156
+ Threshold: >= 85% (7/8 minimum)
157
157
  If below: internal refinement loop (max 3x)
158
158
  ```
159
159
 
@@ -393,7 +393,7 @@ Post-conditions:
393
393
  9. No placeholders ([TODO], [TBD]) in output
394
394
  10. Test coverage measured and documented with percentage
395
395
 
396
- Score threshold: 95%
396
+ > These are supplementary enforcement dimensions validated during self-validation (Protocol 5.1). The authoritative threshold is defined above.
397
397
 
398
398
  ---
399
399
 
@@ -103,7 +103,7 @@ Criteria (binary pass/fail):
103
103
  7. No placeholders ([TODO], [TBD]) in output
104
104
 
105
105
  Score = criteria met / total criteria
106
- Threshold: >= 95% (6/7 minimum)
106
+ Threshold: >= 85% (6/7 minimum)
107
107
  If below: internal refinement loop (max 3x)
108
108
  ```
109
109
 
@@ -301,7 +301,7 @@ Contents:
301
301
  - Identified constraints
302
302
  - User level assessment update
303
303
  Post-conditions:
304
- - WU report at chati.dev/artifacts/0-WU/wu-report.md
304
+ - WU report at chati.dev/artifacts/0-WU/wu-operational-report.md
305
305
  - session.yaml updated with WU completion data
306
306
  ```
307
307
 
@@ -318,7 +318,7 @@ Post-conditions:
318
318
  7. All user inputs acknowledged and incorporated
319
319
  8. No assumptions made without user confirmation
320
320
 
321
- Score threshold: 95%
321
+ > These are supplementary enforcement dimensions validated during self-validation (Protocol 5.1). The authoritative threshold is defined above.
322
322
 
323
323
  ---
324
324
 
@@ -133,7 +133,7 @@ Criteria (binary pass/fail):
133
133
  10. No placeholders ([TODO], [TBD]) in output
134
134
 
135
135
  Score = criteria met / total criteria
136
- Threshold: >= 95% (9/10 minimum)
136
+ Threshold: >= 90% (9/10 minimum)
137
137
  ```
138
138
 
139
139
  ---
@@ -336,7 +336,7 @@ Beyond self-validation (Protocol 5.1), the Architect agent enforces:
336
336
  | Failure Scenario | Recovery Action |
337
337
  |-----------------|-----------------|
338
338
  | PRD artifact missing or unreadable | Halt activation. Log error to session. Prompt user to re-run Detail agent or provide PRD manually. |
339
- | Self-validation score < 95% | Re-enter internal refinement loop (max 3 iterations). If still below threshold, present specific gaps to user for resolution. |
339
+ | Self-validation score < 90% | Re-enter internal refinement loop (max 3 iterations). If still below threshold, present specific gaps to user for resolution. |
340
340
  | User rejects architecture decisions | Capture rejection reasons. Return to the relevant Step (2 for stack, 3 for design, 4 for data). Do not restart from Step 1 unless user requests it. |
341
341
  | context7 MCP unavailable | Continue without library documentation lookup. Note in architecture document that library compatibility was not verified via documentation. Use best available knowledge. |
342
342
  | Tech stack conflict with existing codebase (brownfield) | Document the conflict explicitly. Present migration options with effort estimates. Let user decide between adapting requirements or planning migration. |