chati-dev 4.0.10 → 4.1.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 (107) hide show
  1. package/README.md +5 -0
  2. package/bin/chati.js +23 -2
  3. package/framework/agents/build/dev.md +43 -10
  4. package/framework/agents/discover/brief.md +38 -8
  5. package/framework/agents/discover/brownfield-wu.md +44 -3
  6. package/framework/agents/discover/greenfield-wu.md +14 -0
  7. package/framework/agents/plan/architect.md +6 -0
  8. package/framework/agents/plan/detail.md +25 -0
  9. package/framework/agents/plan/tasks.md +29 -1
  10. package/framework/agents/plan/ux-brand-architect.md +215 -0
  11. package/framework/agents/plan/ux-component-engineer.md +289 -0
  12. package/framework/agents/plan/ux-researcher.md +166 -0
  13. package/framework/agents/plan/ux.md +126 -1008
  14. package/framework/agents/quality/qa-implementation.md +121 -22
  15. package/framework/agents/quality/qa-planning.md +18 -0
  16. package/framework/config.yaml +15 -4
  17. package/framework/constitution.md +8 -2
  18. package/framework/context/root.md +1 -1
  19. package/framework/data/entity-registry.yaml +59 -3
  20. package/framework/hooks/constitution-guard.js +67 -1
  21. package/framework/hooks/license-guard.js +4 -4
  22. package/framework/hooks/model-governance.js +2 -1
  23. package/framework/hooks/prism-engine.js +74 -6
  24. package/framework/hooks/read-protection.js +1 -1
  25. package/framework/hooks/session-digest.js +159 -7
  26. package/framework/hooks/settings.json +16 -4
  27. package/framework/hooks/style-guard.js +134 -0
  28. package/framework/hooks/undercover-guard.js +220 -0
  29. package/framework/intelligence/context-engine.md +21 -0
  30. package/framework/intelligence/hooks-performance.md +54 -0
  31. package/framework/intelligence/memory-layer.md +47 -0
  32. package/framework/migrations/v4.0-to-v4.1.yaml +165 -0
  33. package/framework/orchestrator/chati.md +327 -1067
  34. package/framework/templates/brandbook-html-tmpl.md +107 -0
  35. package/framework/templates/session-memory-tmpl.yaml +68 -0
  36. package/package.json +1 -1
  37. package/src/autonomy/build-state.js +1 -1
  38. package/src/autonomy/worktree-manager.js +13 -13
  39. package/src/config/agent-customizer.js +1 -1
  40. package/src/config/gemini-hooks-generator.js +6 -6
  41. package/src/config/ide-configs.js +1 -1
  42. package/src/context/bracket-tracker.js +25 -4
  43. package/src/context/engine.js +37 -7
  44. package/src/context/formatter.js +45 -1
  45. package/src/context/index.js +3 -3
  46. package/src/dashboard/data-reader.js +7 -7
  47. package/src/decision/engine.js +2 -2
  48. package/src/decision/registry-healer.js +1 -1
  49. package/src/decision/registry-updater.js +2 -2
  50. package/src/extensions/loader.js +1 -1
  51. package/src/gates/g1-planning-complete.js +1 -1
  52. package/src/gates/g2-qa-planning.js +1 -1
  53. package/src/gates/g3-implementation.js +4 -4
  54. package/src/gates/g4-qa-implementation.js +2 -2
  55. package/src/health/auto-fix.js +3 -3
  56. package/src/health/engine.js +2 -2
  57. package/src/installer/brownfield-upgrader.js +3 -3
  58. package/src/installer/manifest.js +1 -1
  59. package/src/installer/transaction.js +1 -1
  60. package/src/installer/validator.js +2 -2
  61. package/src/intelligence/decision-engine.js +1 -1
  62. package/src/intelligence/memory-manager.js +1 -1
  63. package/src/intelligence/registry-manager.js +2 -2
  64. package/src/intelligence/timeline.js +1 -1
  65. package/src/license/client.js +20 -2
  66. package/src/license/commands.js +7 -7
  67. package/src/memory/agent-memory.js +3 -3
  68. package/src/memory/daily-digest.js +170 -0
  69. package/src/memory/dream.js +254 -0
  70. package/src/memory/gotchas.js +2 -2
  71. package/src/memory/index.js +18 -0
  72. package/src/memory/magic-docs.js +98 -0
  73. package/src/memory/memory-extractor.js +163 -0
  74. package/src/memory/session-digest.js +144 -6
  75. package/src/merger/yaml-merger.js +1 -1
  76. package/src/orchestrator/cli.js +980 -0
  77. package/src/orchestrator/handoff-engine.js +25 -4
  78. package/src/orchestrator/index.js +9 -0
  79. package/src/orchestrator/session-manager.js +1 -1
  80. package/src/preview/detector.js +3 -3
  81. package/src/preview/launcher.js +2 -2
  82. package/src/quality/metrics-collector.js +1 -1
  83. package/src/quality/test-runner.js +2 -4
  84. package/src/scanning/density-scanner.js +51 -0
  85. package/src/scanning/env-scanner.js +97 -0
  86. package/src/scanning/index.js +7 -0
  87. package/src/scanning/leakage-scanner.js +54 -0
  88. package/src/scanning/placeholder-scanner.js +40 -0
  89. package/src/scanning/security-scanner.js +94 -0
  90. package/src/security/bash-security.js +335 -0
  91. package/src/security/index.js +9 -0
  92. package/src/telemetry/config.js +3 -5
  93. package/src/telemetry/sender.js +19 -17
  94. package/src/terminal/cli-registry.js +1 -1
  95. package/src/terminal/cost-tracker.js +1 -2
  96. package/src/terminal/prompt-builder.js +11 -27
  97. package/src/terminal/rate-limiter.js +1 -2
  98. package/src/terminal/run-agent.js +3 -3
  99. package/src/terminal/spawner.js +41 -4
  100. package/src/upgrade/checker.js +2 -2
  101. package/src/upgrade/migrator.js +1 -1
  102. package/src/utils/config-parser.js +1 -1
  103. package/src/utils/file-lock.js +3 -3
  104. package/src/utils/provider-limits.js +35 -4
  105. package/src/wizard/i18n.js +2 -2
  106. package/src/wizard/index.js +2 -1
  107. package/src/wizard/questions.js +4 -2
@@ -157,6 +157,22 @@ Where:
157
157
 
158
158
  ---
159
159
 
160
+ ## Memory Consolidation (Dream System)
161
+
162
+ The `/chati dream` command triggers a 4-phase consolidation cycle inspired by Claude Code's autoDream:
163
+
164
+ | Phase | Name | Action |
165
+ |-------|------|--------|
166
+ | 1 | Orient | Scan all agent MEMORY.md files, count entries, assess landscape |
167
+ | 2 | Gather | Read all memories and recent session digests into unified list |
168
+ | 3 | Consolidate | Deduplicate by content hash, merge cross-agent entries, increment evidence_count |
169
+ | 4 | Prune | If total > 200 entries, remove by tier (cold first) then confidence then access_count. Archive removed to `.chati/memories/shared/archive/` |
170
+
171
+ Consolidation is non-destructive — removed entries are archived, not deleted.
172
+ The consolidation report includes: merged count, pruned count, archived count, remaining entries, contradictions found.
173
+
174
+ ---
175
+
160
176
  ## Agent Privacy
161
177
 
162
178
  Each agent has:
@@ -167,6 +183,37 @@ This prevents cross-contamination while enabling knowledge sharing.
167
183
 
168
184
  ---
169
185
 
186
+ ## Per-Turn Memory Extraction
187
+
188
+ The memory extraction system automatically captures knowledge from agent output after each turn.
189
+
190
+ **Extraction patterns:**
191
+ - Decisions: "decided to", "chose", "selected" → type: decision, sector: episodic
192
+ - Resolutions: "fixed by", "resolved", "solved" → type: resolution, sector: procedural
193
+ - User corrections: "actually", "no, use" → type: user_correction, sector: reflective
194
+ - Validated patterns: "confirmed", "verified", "works" → type: validated_pattern, sector: semantic
195
+ - Error patterns: "error:", "failed because" → type: error_pattern, sector: episodic
196
+
197
+ **Budget:** Maximum 3 memories per turn. Confidence starts at 0.5 (warm tier).
198
+ **Deduplication:** Content is normalized and hashed to prevent duplicate entries.
199
+
200
+ ---
201
+
202
+ ## Daily Digest (KAIROS Lite)
203
+
204
+ The `/chati digest` command displays cumulative daily activity logs stored in `.chati/memories/shared/daily/YYYY-MM-DD.md`.
205
+
206
+ Each session appends an entry with:
207
+ - Timestamp and pipeline phase
208
+ - Current agent and completion stats
209
+ - Agent scores (average and per-agent)
210
+ - Decisions made and gotchas found
211
+ - Session duration
212
+
213
+ Digests are append-only (never overwritten) and accumulate throughout the day.
214
+
215
+ ---
216
+
170
217
  ## Integration with Context Engine
171
218
 
172
219
  | Bracket | Memory Level | Behavior |
@@ -0,0 +1,165 @@
1
+ # Migration: v4.0.x → v4.1.0 "Phoenix"
2
+ # Intelligence Upgrade inspired by Claude Code source leak analysis
3
+
4
+ from_version: "4.0.4"
5
+ to_version: "4.1.0"
6
+ created_at: "2026-04-02"
7
+ description: >
8
+ Intelligence Upgrade: orchestrator v2 (thin prompt + CLI handler),
9
+ memory extraction, dream consolidation, daily digest, undercover mode,
10
+ style guard, bash security (23 checks), model-aware context windows,
11
+ brandbook HTML, frustration detection, static/dynamic PRISM boundary,
12
+ microcompact advisory, model fallback (opus→sonnet).
13
+ breaking: false
14
+
15
+ preconditions:
16
+ - type: version_gte
17
+ version: "4.0.0"
18
+ message: "Requires chati.dev v4.0.0 or later"
19
+ - type: constitution_articles
20
+ count: 19
21
+ message: "Requires Constitution with 19 Articles"
22
+
23
+ backup:
24
+ directories:
25
+ - chati.dev/hooks
26
+ - chati.dev/orchestrator
27
+ - chati.dev/intelligence
28
+ - chati.dev/templates
29
+ - chati.dev/agents/plan
30
+ - chati.dev/context
31
+ - chati.dev/data
32
+ files:
33
+ - chati.dev/config.yaml
34
+ - chati.dev/constitution.md
35
+
36
+ operations:
37
+ # --- New hooks ---
38
+ - type: copy_file
39
+ source: chati.dev/hooks/undercover-guard.js
40
+ destination: chati.dev/hooks/undercover-guard.js
41
+ strategy: replace
42
+ description: "Undercover mode: sanitize framework terms from deliverables"
43
+
44
+ - type: copy_file
45
+ source: chati.dev/hooks/style-guard.js
46
+ destination: chati.dev/hooks/style-guard.js
47
+ strategy: replace
48
+ description: "Style guard: em-dash and emoji enforcement"
49
+
50
+ # --- Hook settings (includes new hooks) ---
51
+ - type: copy_file
52
+ source: chati.dev/hooks/settings.json
53
+ destination: chati.dev/hooks/settings.json
54
+ strategy: replace
55
+ description: "Register undercover-guard and style-guard hooks"
56
+
57
+ # --- Updated hooks (security checks, model-aware context, etc.) ---
58
+ - type: copy_file
59
+ source: chati.dev/hooks/constitution-guard.js
60
+ destination: chati.dev/hooks/constitution-guard.js
61
+ strategy: replace
62
+ description: "23-point shell injection defense system"
63
+
64
+ - type: copy_file
65
+ source: chati.dev/hooks/prism-engine.js
66
+ destination: chati.dev/hooks/prism-engine.js
67
+ strategy: replace
68
+ description: "Model-aware context, frustration detection, microcompact advisory"
69
+
70
+ - type: copy_file
71
+ source: chati.dev/hooks/session-digest.js
72
+ destination: chati.dev/hooks/session-digest.js
73
+ strategy: replace
74
+ description: "Structured 8-section digest, auto daily digest, auto dream consolidation"
75
+
76
+ # --- New templates ---
77
+ - type: copy_file
78
+ source: chati.dev/templates/session-memory-tmpl.yaml
79
+ destination: chati.dev/templates/session-memory-tmpl.yaml
80
+ strategy: replace
81
+ description: "8-section structured session memory template"
82
+
83
+ - type: copy_file
84
+ source: chati.dev/templates/brandbook-html-tmpl.md
85
+ destination: chati.dev/templates/brandbook-html-tmpl.md
86
+ strategy: replace
87
+ description: "Brandbook HTML visual style guide spec"
88
+
89
+ # --- Orchestrator v2 ---
90
+ - type: copy_file
91
+ source: chati.dev/orchestrator/chati.md
92
+ destination: chati.dev/orchestrator/chati.md
93
+ strategy: replace
94
+ description: "Orchestrator v2: thin prompt + CLI handler"
95
+
96
+ # --- Constitution (Article XIII expanded) ---
97
+ - type: copy_file
98
+ source: chati.dev/constitution.md
99
+ destination: chati.dev/constitution.md
100
+ strategy: replace
101
+ description: "Article XIII: 7→10 points (dream, extraction, digest)"
102
+
103
+ # --- Intelligence docs ---
104
+ - type: copy_file
105
+ source: chati.dev/intelligence/memory-layer.md
106
+ destination: chati.dev/intelligence/memory-layer.md
107
+ strategy: replace
108
+ description: "Memory Consolidation, Per-Turn Extraction, Daily Digest sections"
109
+
110
+ - type: copy_file
111
+ source: chati.dev/intelligence/context-engine.md
112
+ destination: chati.dev/intelligence/context-engine.md
113
+ strategy: replace
114
+ description: "Static/Dynamic PRISM Boundary, Token-Based Estimation"
115
+
116
+ # --- Entity registry ---
117
+ - type: copy_file
118
+ source: chati.dev/data/entity-registry.yaml
119
+ destination: chati.dev/data/entity-registry.yaml
120
+ strategy: replace
121
+ description: "7 new entities (55→62)"
122
+
123
+ # --- Context files ---
124
+ - type: copy_file
125
+ source: chati.dev/context/root.md
126
+ destination: chati.dev/context/root.md
127
+ strategy: replace
128
+ description: "Version bump to 4.1.0"
129
+
130
+ # --- UX agent (brandbook HTML) ---
131
+ - type: copy_file
132
+ source: chati.dev/agents/plan/ux.md
133
+ destination: chati.dev/agents/plan/ux.md
134
+ strategy: replace
135
+ description: "Mandatory brandbook.html output (criterion #21)"
136
+
137
+ # --- Config (version + 10 new feature flags) ---
138
+ - type: update_yaml
139
+ path: chati.dev/config.yaml
140
+ changes:
141
+ version: "4.1.0"
142
+ installer_version: "4.1.0"
143
+ description: "Bump version and add Intelligence Upgrade feature flags"
144
+
145
+ validation:
146
+ - type: file_exists
147
+ path: chati.dev/hooks/undercover-guard.js
148
+ - type: file_exists
149
+ path: chati.dev/hooks/style-guard.js
150
+ - type: file_exists
151
+ path: chati.dev/templates/session-memory-tmpl.yaml
152
+ - type: file_exists
153
+ path: chati.dev/templates/brandbook-html-tmpl.md
154
+ - type: yaml_field
155
+ path: chati.dev/config.yaml
156
+ field: version
157
+ value: "4.1.0"
158
+ - type: yaml_field
159
+ path: chati.dev/data/entity-registry.yaml
160
+ field: metadata.entity_count
161
+ value: 62
162
+
163
+ rollback:
164
+ description: "Restore from backup created before migration"
165
+ command: "npx chati-dev upgrade --rollback"