thinkwork-cli 0.12.15 → 0.12.17

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 (152) hide show
  1. package/dist/{api-client-4VT3FWOH.js → api-client-JUBCQQDF.js} +1 -1
  2. package/dist/{chunk-H7AB42ES.js → chunk-STY44FQO.js} +13 -0
  3. package/dist/cli.js +1107 -10225
  4. package/dist/commands/enterprise/templates/deploy-repo/docs/runbook.md +3 -8
  5. package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +1 -184
  6. package/dist/drizzle/0050_brain_v0_entity_subtype.sql +2 -2
  7. package/dist/drizzle/0051_brain_v0_tenant_entity_pages.sql +6 -6
  8. package/dist/drizzle/0052_brain_v0_external_refs.sql +2 -2
  9. package/dist/drizzle/0053_brain_v0_unresolved_mentions_subtype.sql +2 -2
  10. package/dist/drizzle/0145_knowledge_graph_thread_ingest.sql +14 -14
  11. package/dist/drizzle/0146_knowledge_graph_source_scope.sql +1 -1
  12. package/dist/drizzle/0157_knowledge_graph_observations_source.sql +2 -2
  13. package/dist/drizzle/0158_wiki_tenant_scope.sql +1 -1
  14. package/dist/drizzle/0165_plugin_premium_entitlements.sql +2 -2
  15. package/dist/drizzle/{0166_company_brain_substrate_contract.sql → 0166_brain_substrate_contract.sql} +9 -9
  16. package/dist/drizzle/{0167_company_brain_artifact_manifest_runtime.sql → 0167_brain_artifact_manifest_runtime.sql} +5 -5
  17. package/dist/drizzle/0168_eval_skill_gate.sql +1 -1
  18. package/dist/drizzle/0183_okf_artifact_manifests.sql +1 -1
  19. package/dist/drizzle/0197_rcm_context_columns.sql +28 -0
  20. package/dist/drizzle/0200_eval_results_execution_tier.sql +40 -0
  21. package/dist/drizzle/0201_brain_dream_runs.sql +72 -0
  22. package/dist/drizzle/0202_backfill_thread_participants_from_senders.sql +110 -0
  23. package/dist/drizzle/0203_threads_mode_override.sql +61 -0
  24. package/dist/drizzle/0204_thread_turns_triggering_message_id.sql +48 -0
  25. package/dist/drizzle/0205_routines_git_python.sql +185 -0
  26. package/dist/drizzle/0206_agent_loop_versions_routine_actions.sql +40 -0
  27. package/dist/drizzle/0207_tenant_credentials_github_repo_kind.sql +52 -0
  28. package/dist/drizzle/0208_knowledge_graph_neutral_identifiers.sql +253 -0
  29. package/dist/drizzle/0209_living_artifacts_schema.sql +109 -0
  30. package/dist/drizzle/0210_think137_automations_additive_schema.sql +113 -0
  31. package/dist/drizzle/0211_backfill_agent_loop_versions_target_spec.sql +120 -0
  32. package/dist/drizzle/0212_fold_webhooks_into_automations.sql +312 -0
  33. package/dist/drizzle/0213_agent_loop_versions_judge_evidence_nullable.sql +63 -0
  34. package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +99 -0
  35. package/dist/drizzle/0215_agent_loop_versions_goal_worker_policy_nullable.sql +70 -0
  36. package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +81 -0
  37. package/dist/drizzle/0217_agents_capability_folder_dispatch.sql +12 -0
  38. package/dist/drizzle/0218_document_plates.sql +30 -0
  39. package/dist/drizzle/0219_document_section_waivers.sql +29 -0
  40. package/dist/drizzle/0220_artifacts_created_by_user.sql +21 -0
  41. package/dist/drizzle/0221_artifact_shares.sql +29 -0
  42. package/dist/drizzle/0221_workflow_interpreter_thin_slice.sql +71 -0
  43. package/dist/drizzle/0222_compliance_drainer_select_audit_events.sql +21 -0
  44. package/dist/drizzle/0223_document_conformance_reports.sql +38 -0
  45. package/dist/drizzle/0224_artifact_refresh_state.sql +11 -0
  46. package/dist/drizzle/0225_think216_agent_loop_convergence.sql +21 -0
  47. package/dist/drizzle/0226_drop_n8n_agent_step_runs.sql +6 -0
  48. package/dist/drizzle/0227_analyst_reader_role.sql +1055 -0
  49. package/dist/drizzle/0228_tenant_credentials_rds_iam_kind.sql +62 -0
  50. package/dist/drizzle/0229_analyst_reader_rds_iam_grant.sql +79 -0
  51. package/dist/drizzle/0230_analyst_rls.sql +1613 -0
  52. package/dist/drizzle/0231_cost_events_cache_write_enforcement_exempt.sql +11 -0
  53. package/dist/plugins/catalog/package.json +0 -1
  54. package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +0 -1
  55. package/dist/plugins/catalog/src/__tests__/catalog.test.ts +16 -8
  56. package/dist/plugins/catalog/src/__tests__/contracts.test.ts +56 -0
  57. package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +0 -2
  58. package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -5
  59. package/dist/plugins/catalog/src/contracts.ts +112 -0
  60. package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -6
  61. package/dist/plugins/n8n/README.md +4 -36
  62. package/dist/plugins/n8n/src/deployment/managed-app.ts +0 -17
  63. package/dist/plugins/n8n/src/manifest.ts +0 -5
  64. package/dist/plugins/n8n/terraform/n8n/main.tf +0 -26
  65. package/dist/plugins/n8n/terraform/n8n/outputs.tf +0 -5
  66. package/dist/plugins/n8n/terraform/n8n/variables.tf +0 -6
  67. package/dist/plugins/n8n/test/manifest.test.ts +0 -1
  68. package/dist/plugins/twenty/package.json +5 -0
  69. package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +232 -0
  70. package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +489 -0
  71. package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +199 -0
  72. package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +43 -0
  73. package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +230 -0
  74. package/dist/plugins/twenty/scripts/lib/__tests__/twenty-client.test.ts +207 -0
  75. package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +282 -0
  76. package/dist/plugins/twenty/scripts/lib/load-attachments.ts +220 -0
  77. package/dist/plugins/twenty/scripts/lib/load-records.ts +680 -0
  78. package/dist/plugins/twenty/scripts/lib/mappers.ts +559 -0
  79. package/dist/plugins/twenty/scripts/lib/members-ensure.ts +381 -0
  80. package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +191 -0
  81. package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +425 -0
  82. package/dist/plugins/twenty/scripts/lib/twenty-client.ts +246 -0
  83. package/dist/plugins/twenty/scripts/migrate-lastmile.ts +610 -0
  84. package/dist/plugins/twenty/scripts/provision-twenty-members.ts +214 -0
  85. package/dist/plugins/twenty/src/manifest.ts +99 -0
  86. package/dist/plugins/twenty/terraform/twenty/README.md +1 -1
  87. package/dist/plugins/twenty/test/manifest.test.ts +12 -2
  88. package/dist/terraform/examples/greenfield/main.tf +90 -380
  89. package/dist/terraform/examples/greenfield/terraform.tfvars.example +0 -1
  90. package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
  91. package/dist/terraform/modules/app/agentcore-pi/main.tf +36 -32
  92. package/dist/terraform/modules/app/agentcore-pi/variables.tf +23 -15
  93. package/dist/terraform/modules/app/agentcore-runtime/main.tf +3 -3
  94. package/dist/terraform/modules/app/customer-domain/main.tf +16 -2
  95. package/dist/terraform/modules/app/deployment-control-plane/main.tf +5 -0
  96. package/dist/terraform/modules/app/deployment-control-plane/runner.py +85 -207
  97. package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +56 -2
  98. package/dist/terraform/modules/app/hindsight-memory/main.tf +52 -4
  99. package/dist/terraform/modules/app/lambda-api/eval-fanout.tf +7 -0
  100. package/dist/terraform/modules/app/lambda-api/handlers.tf +493 -89
  101. package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +215 -96
  102. package/dist/terraform/modules/app/lambda-api/main.tf +24 -5
  103. package/dist/terraform/modules/app/lambda-api/outputs.tf +19 -11
  104. package/dist/terraform/modules/app/lambda-api/variables.tf +94 -67
  105. package/dist/terraform/modules/app/ses-email/main.tf +14 -2
  106. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/main.tf +493 -0
  107. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/outputs.tf +34 -0
  108. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/variables.tf +32 -0
  109. package/dist/terraform/modules/data/aurora-postgres/main.tf +55 -0
  110. package/dist/terraform/modules/data/aurora-postgres/outputs.tf +15 -0
  111. package/dist/terraform/modules/data/s3-buckets/main.tf +26 -0
  112. package/dist/terraform/modules/thinkwork/README.md +0 -1
  113. package/dist/terraform/modules/thinkwork/main.tf +167 -446
  114. package/dist/terraform/modules/thinkwork/outputs.tf +2 -142
  115. package/dist/terraform/modules/thinkwork/variables.tf +55 -309
  116. package/dist/terraform/schema.graphql +4 -0
  117. package/dist/workspace-defaults/files/AGENTS.md +45 -31
  118. package/dist/workspace-defaults/files/CONTEXT.md +48 -4
  119. package/dist/workspace-defaults/files/GUARDRAILS.md +18 -0
  120. package/dist/workspace-defaults/files/MEMORY_GUIDE.md +32 -4
  121. package/dist/workspace-defaults/files/SPACE.md +34 -19
  122. package/dist/workspace-defaults/files/TOOLS.md +30 -0
  123. package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +154 -0
  124. package/dist/workspace-defaults/files/skills/document-composer/references/authoring-rules.md +101 -0
  125. package/package.json +2 -1
  126. package/dist/plugins/company-brain/README.md +0 -37
  127. package/dist/plugins/company-brain/package.json +0 -33
  128. package/dist/plugins/company-brain/runtime/cognee/Dockerfile +0 -11
  129. package/dist/plugins/company-brain/smoke/cognee-managed-app-smoke.mjs +0 -458
  130. package/dist/plugins/company-brain/smoke/cognee-memory-cutover-smoke.mjs +0 -539
  131. package/dist/plugins/company-brain/smoke/company-brain-context-engine-smoke.mjs +0 -312
  132. package/dist/plugins/company-brain/smoke/company-brain-operations-smoke.mjs +0 -449
  133. package/dist/plugins/company-brain/smoke/company-brain-plugin-smoke.mjs +0 -655
  134. package/dist/plugins/company-brain/smoke/hindsight-memory-isolation-smoke.mjs +0 -474
  135. package/dist/plugins/company-brain/src/api/cognee-client.ts +0 -896
  136. package/dist/plugins/company-brain/src/api/cognee-cluster-identity.ts +0 -49
  137. package/dist/plugins/company-brain/src/api/cognee-memory-scope.ts +0 -84
  138. package/dist/plugins/company-brain/src/api/context-engine-provider.ts +0 -888
  139. package/dist/plugins/company-brain/src/api/migration.ts +0 -665
  140. package/dist/plugins/company-brain/src/deployment/cognee-managed-app.ts +0 -396
  141. package/dist/plugins/company-brain/src/index.ts +0 -62
  142. package/dist/plugins/company-brain/src/manifest.ts +0 -112
  143. package/dist/plugins/company-brain/terraform/cognee/README.md +0 -263
  144. package/dist/plugins/company-brain/terraform/cognee/main.tf +0 -766
  145. package/dist/plugins/company-brain/terraform/cognee/outputs.tf +0 -144
  146. package/dist/plugins/company-brain/terraform/cognee/variables.tf +0 -402
  147. package/dist/plugins/company-brain/test/api/cognee-client.test.ts +0 -562
  148. package/dist/plugins/company-brain/test/api/cognee-memory-scope.test.ts +0 -74
  149. package/dist/plugins/company-brain/test/api/context-engine-provider.test.ts +0 -447
  150. package/dist/plugins/company-brain/test/api/migration.test.ts +0 -465
  151. package/dist/plugins/company-brain/test/manifest.test.ts +0 -95
  152. package/dist/plugins/company-brain/tsconfig.json +0 -8
@@ -192,108 +192,13 @@ output "hindsight_endpoint" {
192
192
  value = local.hindsight_enabled ? module.hindsight[0].hindsight_endpoint : null
193
193
  }
194
194
 
195
- output "cognee_enabled" {
196
- description = "Whether the Cognee ontology/knowledge-graph add-on is enabled"
197
- value = local.cognee_enabled
198
- }
199
-
200
- output "cognee_endpoint" {
201
- description = "Internal Cognee API endpoint (null when enable_cognee = false)"
202
- value = local.cognee_enabled ? module.cognee[0].cognee_endpoint : null
203
- }
204
-
205
- output "cognee_log_group_name" {
206
- description = "CloudWatch log group for Cognee (null when enable_cognee = false)"
207
- value = local.cognee_enabled ? module.cognee[0].cognee_log_group_name : null
208
- }
209
-
210
- output "cognee_task_role_arn" {
211
- description = "IAM role assumed by the Cognee ECS task (null when enable_cognee = false)"
212
- value = local.cognee_enabled ? module.cognee[0].cognee_task_role_arn : null
213
- }
214
-
215
- output "cognee_execution_role_arn" {
216
- description = "IAM role used by ECS to pull the Cognee image and inject secrets (null when enable_cognee = false)"
217
- value = local.cognee_enabled ? module.cognee[0].cognee_execution_role_arn : null
218
- }
219
-
220
- output "cognee_backend_mode" {
221
- description = "Selected Cognee backend mode (null when enable_cognee = false)"
222
- value = local.cognee_enabled ? module.cognee[0].cognee_backend_mode : null
223
- }
224
-
225
- output "cognee_brain_instance_key" {
226
- description = "Tenant-scoped Company Brain instance key (null when enable_cognee = false or legacy stage-wide mode)."
227
- value = local.cognee_enabled ? module.cognee[0].cognee_brain_instance_key : null
228
- }
229
-
230
- output "cognee_brain_tenant_id" {
231
- description = "Tenant ID owning this Company Brain substrate instance (null when enable_cognee = false or legacy stage-wide mode)."
232
- value = local.cognee_enabled ? module.cognee[0].cognee_brain_tenant_id : null
233
- }
234
-
235
- output "cognee_brain_storage_tier" {
236
- description = "Company Brain storage tier (null when enable_cognee = false)."
237
- value = local.cognee_enabled ? module.cognee[0].cognee_brain_storage_tier : null
238
- }
239
-
240
- output "cognee_graph_database_provider" {
241
- description = "Cognee graph provider selected for Company Brain (null when enable_cognee = false)."
242
- value = local.cognee_enabled ? module.cognee[0].cognee_graph_database_provider : null
243
- }
244
-
245
- output "cognee_vector_db_provider" {
246
- description = "Cognee vector provider selected for Company Brain (null when enable_cognee = false)."
247
- value = local.cognee_enabled ? module.cognee[0].cognee_vector_db_provider : null
248
- }
249
-
250
- output "cognee_embedding_model" {
251
- description = "Embedding model selected for Company Brain (null when enable_cognee = false)."
252
- value = local.cognee_enabled ? module.cognee[0].cognee_embedding_model : null
253
- }
254
-
255
- output "cognee_embedding_dimensions" {
256
- description = "Embedding vector dimension selected for Company Brain (null when enable_cognee = false)."
257
- value = local.cognee_enabled ? module.cognee[0].cognee_embedding_dimensions : null
258
- }
259
-
260
- output "cognee_cluster_arn" {
261
- description = "Company Brain ECS cluster ARN hosting the Cognee service (null when enable_cognee = false)"
262
- value = local.cognee_enabled ? module.cognee[0].cognee_cluster_arn : null
263
- }
264
-
265
- output "cognee_service_name" {
266
- description = "ECS service name for Cognee (null when enable_cognee = false)"
267
- value = local.cognee_enabled ? module.cognee[0].cognee_service_name : null
268
- }
269
-
270
- output "cognee_security_group_id" {
271
- description = "Security group ID for the Cognee ECS task (null when enable_cognee = false)"
272
- value = local.cognee_enabled ? module.cognee[0].cognee_security_group_id : null
273
- }
274
-
275
- output "cognee_worker_security_group_id" {
276
- description = "Security group ID attached to the Knowledge Graph ingest worker Lambda (null when enable_cognee = false)"
277
- value = local.cognee_enabled ? aws_security_group.cognee_worker[0].id : null
278
- }
279
-
280
- output "knowledge_graph_thread_ingest_fn_name" {
281
- description = "Knowledge Graph thread ingest worker Lambda function name"
282
- value = module.api.knowledge_graph_thread_ingest_fn_name
283
- }
284
-
285
- output "knowledge_graph_thread_ingest_fn_arn" {
286
- description = "Knowledge Graph thread ingest worker Lambda ARN"
287
- value = module.api.knowledge_graph_thread_ingest_fn_arn
288
- }
289
-
290
195
  output "brain_artifacts_bucket_name" {
291
- description = "Canonical Company Brain S3 bucket for source artifacts, ingestion manifests, migration snapshots, vault projections, and exports."
196
+ description = "Canonical ThinkWork Brain S3 bucket for source artifacts, ingestion manifests, migration snapshots, vault projections, and exports."
292
197
  value = module.api.brain_artifacts_bucket_name
293
198
  }
294
199
 
295
200
  output "brain_artifacts_bucket_arn" {
296
- description = "ARN of the canonical Company Brain artifact bucket."
201
+ description = "ARN of the canonical ThinkWork Brain artifact bucket."
297
202
  value = module.api.brain_artifacts_bucket_arn
298
203
  }
299
204
 
@@ -327,46 +232,6 @@ output "okf_efs_refresh_fn_arn" {
327
232
  value = module.api.okf_efs_refresh_fn_arn
328
233
  }
329
234
 
330
- output "cognee_storage_file_system_id" {
331
- description = "EFS file system ID backing Cognee writable data/system directories (null when enable_cognee = false)"
332
- value = local.cognee_enabled ? module.cognee[0].cognee_storage_file_system_id : null
333
- }
334
-
335
- output "cognee_s3_artifact_root" {
336
- description = "Canonical Company Brain S3 source artifact root (null when enable_cognee = false)."
337
- value = local.cognee_enabled ? module.cognee[0].cognee_s3_artifact_root : null
338
- }
339
-
340
- output "cognee_s3_manifest_root" {
341
- description = "Canonical Company Brain S3 ingestion manifest root (null when enable_cognee = false)."
342
- value = local.cognee_enabled ? module.cognee[0].cognee_s3_manifest_root : null
343
- }
344
-
345
- output "cognee_s3_vault_projection_root" {
346
- description = "Canonical Company Brain S3 vault projection root (null when enable_cognee = false)."
347
- value = local.cognee_enabled ? module.cognee[0].cognee_s3_vault_projection_root : null
348
- }
349
-
350
- output "cognee_neptune_graph_id" {
351
- description = "Neptune Analytics graph ID for production Company Brain (null when enable_cognee = false)."
352
- value = local.cognee_enabled ? module.cognee[0].cognee_neptune_graph_id : null
353
- }
354
-
355
- output "cognee_neptune_endpoint" {
356
- description = "Neptune Analytics endpoint for production Company Brain (null when enable_cognee = false)."
357
- value = local.cognee_enabled ? module.cognee[0].cognee_neptune_endpoint : null
358
- }
359
-
360
- output "cognee_private_substrate_mode" {
361
- description = "Whether Company Brain substrate is private/internal-only (null when enable_cognee = false)."
362
- value = local.cognee_enabled ? module.cognee[0].cognee_private_substrate_mode : null
363
- }
364
-
365
- output "cognee_production_posture" {
366
- description = "Operator evidence string for production-tier approval/readiness posture (null when enable_cognee = false)."
367
- value = local.cognee_enabled ? module.cognee[0].cognee_production_posture : null
368
- }
369
-
370
235
  output "twenty_provisioned" {
371
236
  description = "Whether the Twenty CRM retained managed-app substrate is provisioned"
372
237
  value = local.twenty_provisioned
@@ -527,11 +392,6 @@ output "n8n_service_credential_secret_arn" {
527
392
  value = local.n8n_provisioned ? module.n8n[0].n8n_service_credential_secret_arn : null
528
393
  }
529
394
 
530
- output "n8n_agent_step_bridge_credential_secret_arn" {
531
- description = "Secrets Manager ARN used for the inbound n8n agent-step bridge credential (null when n8n_provisioned = false)"
532
- value = local.n8n_provisioned ? module.n8n[0].n8n_agent_step_bridge_credential_secret_arn : null
533
- }
534
-
535
395
  output "admin_url" {
536
396
  description = "Deprecated compatibility alias for app_url"
537
397
  value = local.end_user_app_url
@@ -354,21 +354,26 @@ variable "enable_hindsight" {
354
354
  }
355
355
 
356
356
  variable "memory_engine" {
357
- description = "Active long-term memory engine for canonical recall/inspect/export. Exactly one engine is authoritative per deployment. Empty auto-selects Hindsight for full installs. Accepted values: 'hindsight' (requires enable_hindsight = true), 'agentcore' (explicit low-cost/development managed-memory mode), or legacy diagnostic 'cognee' (requires enable_cognee = true and is not the supported user/Space memory path). Legacy value 'managed' maps to 'agentcore'."
357
+ description = "Active long-term memory engine for canonical recall/inspect/export. Exactly one engine is authoritative per deployment. Empty auto-selects Hindsight for full installs. Accepted values: 'hindsight' (requires enable_hindsight = true) or 'agentcore' (explicit low-cost/development managed-memory mode). Legacy value 'managed' maps to 'agentcore'."
358
358
  type = string
359
359
  default = ""
360
360
 
361
361
  validation {
362
- condition = var.memory_engine == "" || contains(["managed", "hindsight", "agentcore", "cognee"], var.memory_engine)
363
- error_message = "memory_engine must be empty, 'hindsight', 'agentcore', 'cognee', or legacy 'managed'."
362
+ condition = var.memory_engine == "" || contains(["managed", "hindsight", "agentcore"], var.memory_engine)
363
+ error_message = "memory_engine must be empty, 'hindsight', 'agentcore', or legacy 'managed'."
364
364
  }
365
-
366
365
  }
367
366
 
368
367
  variable "hindsight_image_tag" {
369
- description = "Hindsight Docker image tag (used when enable_hindsight = true)"
368
+ description = "Hindsight Docker image tag (used when enable_hindsight = true). 0.8.4 upgrade validated 2026-07-06 (THINK-201): migration rehearsal over a dev-data copy passed (orphan-observation backsweep deletes ~650 broken-provenance rows — expected); retain/recall/consolidation verified; 0.8.4 fixes the Bedrock-Anthropic extraction tool schema AND fails retain loudly (500) instead of silently storing zero units. Known upstream gap: maintenance discovery routines (reconcile sweep, mental-model cron, llm_requests retention) expect functions in the public schema and no-op with warnings when HINDSIGHT_API_DATABASE_SCHEMA != public."
370
369
  type = string
371
- default = "0.5.0"
370
+ default = "0.8.4"
371
+ }
372
+
373
+ variable "hindsight_database_name" {
374
+ description = "Dedicated Hindsight database name on the primary Aurora cluster (THINK-220 cutover flag). Empty (default) = legacy layout: Hindsight lives in the `hindsight` schema of the primary database and its upstream maintenance discovery no-ops (see hindsight_image_tag note). Set to e.g. \"thinkwork_hindsight\" AFTER the database exists and its data is migrated (plan 2026-07-07-004): flips the Hindsight service, the api Lambdas, and the Pi runtime to that database's `public` schema in one apply."
375
+ type = string
376
+ default = ""
372
377
  }
373
378
 
374
379
  variable "hindsight_enable_auto_consolidation" {
@@ -388,294 +393,6 @@ variable "hindsight_observations_mission" {
388
393
  type = string
389
394
  default = "Synthesize durable, institutional facts about the business: customers, projects, decisions, processes, tools, relationships, and recurring patterns. Filter out ephemeral state, secrets, and personal small talk."
390
395
  }
391
-
392
- variable "enable_cognee" {
393
- description = "Enable Cognee as optional ThinkWork Brain ontology/knowledge-graph infrastructure. Cognee is plugin-managed Brain substrate infrastructure, not the supported user/Space memory provider."
394
- type = bool
395
- default = false
396
- }
397
-
398
- variable "cognee_image_uri" {
399
- description = "Cognee container image URI pinned to an immutable sha256 digest. Required when enable_cognee = true."
400
- type = string
401
- default = ""
402
-
403
- validation {
404
- condition = var.cognee_image_uri == "" || can(regex("@sha256:[0-9a-f]{64}$", var.cognee_image_uri))
405
- error_message = "cognee_image_uri must be empty or pinned to an immutable sha256 image digest."
406
- }
407
- }
408
-
409
- variable "cognee_db_username" {
410
- description = "Dedicated PostgreSQL username for Cognee metadata storage. Do not use the shared Aurora admin/master user."
411
- type = string
412
- default = "thinkwork_cognee"
413
-
414
- validation {
415
- condition = !contains(["postgres", "thinkwork_admin", "rdsadmin"], lower(var.cognee_db_username))
416
- error_message = "cognee_db_username must be a dedicated least-privilege Cognee database user."
417
- }
418
- }
419
-
420
- variable "cognee_db_name" {
421
- description = "Dedicated PostgreSQL database name for Cognee metadata storage. Do not use the shared Thinkwork application database."
422
- type = string
423
- default = "thinkwork_cognee"
424
-
425
- validation {
426
- condition = can(regex("^[A-Za-z_][A-Za-z0-9_]{0,62}$", var.cognee_db_name))
427
- error_message = "cognee_db_name must be a valid PostgreSQL identifier."
428
- }
429
- }
430
-
431
- variable "cognee_db_password_secret_arn" {
432
- description = "Secrets Manager ARN containing a JSON password field for the dedicated Cognee PostgreSQL user. Required when enable_cognee = true."
433
- type = string
434
- default = ""
435
- }
436
-
437
- variable "cognee_allowed_internal_cidr_blocks" {
438
- description = "CIDR blocks allowed to reach the internal Cognee ALB"
439
- type = list(string)
440
- default = []
441
-
442
- validation {
443
- condition = alltrue([
444
- for cidr in var.cognee_allowed_internal_cidr_blocks :
445
- cidr != "0.0.0.0/0" && cidr != "::/0"
446
- ])
447
- error_message = "cognee_allowed_internal_cidr_blocks must not include all-network CIDRs such as 0.0.0.0/0 or ::/0."
448
- }
449
- }
450
-
451
- variable "cognee_allowed_internal_security_group_ids" {
452
- description = "Security group IDs allowed to reach the internal Cognee ALB"
453
- type = list(string)
454
- default = []
455
- }
456
-
457
- variable "cognee_backend_mode" {
458
- description = "Cognee backend mode. dogfood uses local graph/vector paths on EFS; remote requires remote graph/vector URLs."
459
- type = string
460
- default = "dogfood"
461
-
462
- validation {
463
- condition = contains(["dogfood", "remote"], var.cognee_backend_mode)
464
- error_message = "cognee_backend_mode must be dogfood or remote."
465
- }
466
- }
467
-
468
- variable "cognee_desired_count" {
469
- description = "Desired number of Cognee ECS tasks. Dogfood/local backend mode must stay single-task."
470
- type = number
471
- default = 1
472
- }
473
-
474
- variable "cognee_brain_tenant_id" {
475
- description = "Tenant ID for a tenant-scoped Company Brain substrate instance. Empty preserves the legacy stage-wide Cognee resource names."
476
- type = string
477
- default = ""
478
- }
479
-
480
- variable "cognee_brain_instance_key" {
481
- description = "Stable tenant-scoped Brain instance key used to derive Cognee/Brain resource names."
482
- type = string
483
- default = ""
484
- }
485
-
486
- variable "cognee_brain_storage_tier" {
487
- description = "Company Brain storage tier: default or production."
488
- type = string
489
- default = "default"
490
-
491
- validation {
492
- condition = contains(["default", "production"], var.cognee_brain_storage_tier)
493
- error_message = "cognee_brain_storage_tier must be default or production."
494
- }
495
- }
496
-
497
- variable "cognee_brain_s3_artifact_root" {
498
- description = "Canonical Company Brain S3 root URI for source artifacts."
499
- type = string
500
- default = ""
501
- }
502
-
503
- variable "cognee_brain_s3_manifest_root" {
504
- description = "Canonical Company Brain S3 root URI for ingestion manifests."
505
- type = string
506
- default = ""
507
- }
508
-
509
- variable "cognee_brain_s3_vault_projection_root" {
510
- description = "Canonical Company Brain S3 root URI for vault/materialized projections."
511
- type = string
512
- default = ""
513
- }
514
-
515
- variable "cognee_brain_artifacts_bucket_arn" {
516
- description = "Optional canonical Company Brain artifacts bucket ARN for scoped task-role access."
517
- type = string
518
- default = ""
519
- }
520
-
521
- variable "cognee_brain_artifacts_prefixes" {
522
- description = "Tenant/stage prefixes inside cognee_brain_artifacts_bucket_arn the Brain task may access."
523
- type = list(string)
524
- default = []
525
- }
526
-
527
- variable "cognee_private_substrate_mode" {
528
- description = "Whether the Company Brain substrate is private/internal-only."
529
- type = bool
530
- default = true
531
- }
532
-
533
- variable "cognee_require_authentication" {
534
- description = "Passed to Cognee REQUIRE_AUTHENTICATION."
535
- type = bool
536
- default = false
537
- }
538
-
539
- variable "cognee_enable_backend_access_control" {
540
- description = "Passed to Cognee ENABLE_BACKEND_ACCESS_CONTROL."
541
- type = bool
542
- default = false
543
- }
544
-
545
- variable "cognee_cors_allowed_origins" {
546
- description = "Passed to Cognee CORS_ALLOWED_ORIGINS. Keep empty for internal-only Company Brain substrate."
547
- type = string
548
- default = ""
549
- }
550
-
551
- variable "cognee_llm_provider" {
552
- description = "Cognee LLM provider"
553
- type = string
554
- default = "bedrock"
555
- }
556
-
557
- variable "cognee_llm_model" {
558
- description = "Cognee LLM model"
559
- type = string
560
- default = "bedrock/amazon.nova-lite-v1:0"
561
- }
562
-
563
- variable "cognee_llm_api_key_secret_arn" {
564
- description = "Optional Secrets Manager ARN for non-Bedrock LLM provider API key"
565
- type = string
566
- default = ""
567
- }
568
-
569
- variable "cognee_embedding_provider" {
570
- description = "Cognee embedding provider"
571
- type = string
572
- default = "bedrock"
573
- }
574
-
575
- variable "cognee_embedding_model" {
576
- description = "Cognee embedding model"
577
- type = string
578
- default = "amazon.titan-embed-text-v2:0"
579
- }
580
-
581
- variable "cognee_embedding_dimensions" {
582
- description = "Embedding vector dimensions. Must match the selected Cognee vector store."
583
- type = number
584
- default = 1024
585
- }
586
-
587
- variable "cognee_embedding_api_key_secret_arn" {
588
- description = "Optional Secrets Manager ARN for non-Bedrock embedding provider API key"
589
- type = string
590
- default = ""
591
- }
592
-
593
- variable "cognee_vector_db_provider" {
594
- description = "Cognee vector store provider"
595
- type = string
596
- default = "lancedb"
597
- }
598
-
599
- variable "cognee_vector_db_url" {
600
- description = "Cognee vector store URL. Leave empty in dogfood mode to use the EFS-backed local default."
601
- type = string
602
- default = ""
603
- }
604
-
605
- variable "cognee_vector_db_key_secret_arn" {
606
- description = "Optional Secrets Manager ARN for a remote vector store key"
607
- type = string
608
- default = ""
609
- }
610
-
611
- variable "cognee_graph_database_provider" {
612
- description = "Cognee graph store provider"
613
- type = string
614
- default = "kuzu"
615
- }
616
-
617
- variable "cognee_graph_database_url" {
618
- description = "Cognee graph store URL. Leave empty in dogfood mode to use the EFS-backed local Kuzu default."
619
- type = string
620
- default = ""
621
- }
622
-
623
- variable "cognee_graph_database_username" {
624
- description = "Optional Cognee graph store username"
625
- type = string
626
- default = ""
627
- }
628
-
629
- variable "cognee_graph_database_password_secret_arn" {
630
- description = "Optional Secrets Manager ARN for a remote graph store password"
631
- type = string
632
- default = ""
633
- }
634
-
635
- variable "cognee_neptune_graph_id" {
636
- description = "Neptune Analytics graph ID used by the production Brain tier."
637
- type = string
638
- default = ""
639
- }
640
-
641
- variable "cognee_neptune_graph_arn" {
642
- description = "Optional Neptune Analytics graph ARN for scoped task-role access."
643
- type = string
644
- default = ""
645
- }
646
-
647
- variable "cognee_neptune_endpoint" {
648
- description = "Neptune Analytics endpoint used by the production Brain tier."
649
- type = string
650
- default = ""
651
- }
652
-
653
- variable "cognee_production_posture" {
654
- description = "Operator evidence string for production-tier approval/readiness posture."
655
- type = string
656
- default = ""
657
- }
658
-
659
- variable "cognee_bedrock_model_resource_arns" {
660
- description = "Explicit Bedrock model ARNs Cognee may invoke when a Bedrock LLM or embedding provider is selected."
661
- type = list(string)
662
- default = []
663
-
664
- validation {
665
- condition = alltrue([
666
- for arn in var.cognee_bedrock_model_resource_arns :
667
- arn != "*" && !can(regex("\\*", arn))
668
- ])
669
- error_message = "cognee_bedrock_model_resource_arns must list explicit model or inference-profile ARNs, not wildcards."
670
- }
671
- }
672
-
673
- variable "cognee_kms_key_arns" {
674
- description = "Optional KMS key ARNs needed to decrypt Cognee-injected secrets"
675
- type = list(string)
676
- default = []
677
- }
678
-
679
396
  variable "twenty_provisioned" {
680
397
  description = "Provision the retained Twenty CRM managed-app substrate. Runtime can be parked independently with twenty_runtime_enabled."
681
398
  type = bool
@@ -921,12 +638,6 @@ variable "n8n_service_credential_secret_arn" {
921
638
  default = ""
922
639
  }
923
640
 
924
- variable "n8n_agent_step_bridge_credential_secret_arn" {
925
- description = "Secrets Manager ARN containing the inbound credential used by n8n workflows to call the ThinkWork agent-step bridge."
926
- type = string
927
- default = ""
928
- }
929
-
930
641
  variable "n8n_storage_bucket_name" {
931
642
  description = "S3 bucket name used for n8n managed artifacts and optional storage mode objects. Required when n8n_provisioned = true."
932
643
  type = string
@@ -1124,6 +835,18 @@ variable "requester_memory_dreaming_model_id" {
1124
835
  default = "openai.gpt-oss-120b-1:0"
1125
836
  }
1126
837
 
838
+ variable "brain_dream_state_enabled" {
839
+ description = "Enable the recurring Brain dream-state consolidation schedule (THINK-133 U4). Manual invokes work regardless via event.manual."
840
+ type = bool
841
+ default = false
842
+ }
843
+
844
+ variable "brain_dream_state_schedule_expression" {
845
+ description = "EventBridge Scheduler expression for Brain dream-state runs."
846
+ type = string
847
+ default = "cron(0 5 * * ? *)"
848
+ }
849
+
1127
850
  # ---------------------------------------------------------------------------
1128
851
  # Naming / Buckets
1129
852
  # ---------------------------------------------------------------------------
@@ -1146,6 +869,13 @@ variable "billing_export_manifest_key" {
1146
869
  default = ""
1147
870
  }
1148
871
 
872
+ variable "cost_alert_emails" {
873
+ description = "Email endpoints subscribed to the cost-alerts SNS topic (drift + reconciler-health alarms, THINK-245)."
874
+ type = list(string)
875
+ default = []
876
+ sensitive = true
877
+ }
878
+
1149
879
  variable "billing_reconciliation_tolerance_usd" {
1150
880
  description = "Absolute USD tolerance used when comparing ThinkWork projected aggregate spend to AWS billing export spend."
1151
881
  type = number
@@ -1505,22 +1235,27 @@ variable "wiki_compile_model_id" {
1505
1235
  default = "openai.gpt-oss-120b-1:0"
1506
1236
  }
1507
1237
 
1508
- variable "company_brain_source_agent_model_id" {
1509
- description = "Bedrock model id used by GraphQL Company Brain source agents for JSON tool/action turns. Defaults to Claude Haiku for reliable action output while the wiki compiler can remain on gpt-oss for throughput."
1238
+ variable "brain_source_agent_model_id" {
1239
+ description = "Bedrock model id used by GraphQL Brain source agents for JSON tool/action turns. Defaults to Claude Haiku for reliable action output while the wiki compiler can remain on gpt-oss for throughput."
1510
1240
  type = string
1511
1241
  default = "us.anthropic.claude-haiku-4-5-20251001-v1:0"
1512
1242
  }
1513
1243
 
1514
- variable "company_brain_backdoor_install_key_secret_arn" {
1515
- description = "Optional Secrets Manager ARN containing the temporary Company Brain backdoor install key. Empty disables the backdoor; the raw key is never stored in tfvars or runtime-config."
1516
- type = string
1517
- default = ""
1244
+ variable "knowledge_graph_observations_ingest_enabled" {
1245
+ description = "Enable the Brain distillation schedule (Hindsight observations -> knowledge graph). Ships disabled (plan 2026-07-03-005 U4)."
1246
+ type = bool
1247
+ default = false
1518
1248
  }
1519
1249
 
1520
- variable "company_brain_backdoor_install_key_stages" {
1521
- description = "Comma-separated stage allowlist for the temporary Company Brain backdoor install key. Empty disables deployed backdoor redemption."
1250
+ variable "wiki_source" {
1251
+ description = "Wiki compile pipeline source: 'planner' or 'graph' (THINK-133 U8/KTD-4)."
1522
1252
  type = string
1523
- default = ""
1253
+ default = "planner"
1254
+
1255
+ validation {
1256
+ condition = contains(["planner", "graph"], var.wiki_source)
1257
+ error_message = "wiki_source must be 'planner' or 'graph'."
1258
+ }
1524
1259
  }
1525
1260
 
1526
1261
  variable "wiki_aggregation_pass_enabled" {
@@ -1582,6 +1317,17 @@ variable "compliance_anchor_object_lock_mode" {
1582
1317
  }
1583
1318
  }
1584
1319
 
1320
+ variable "analyst_policy_source" {
1321
+ description = "THINK-229 KTD5 enforcement flip for the analyst connection policy source: 'row' (default — signed sidecar policy is shadow-only) or 'sidecar' (the sidecar block is authoritative). Flip only after clean shadow parity on live traffic."
1322
+ type = string
1323
+ default = "row"
1324
+
1325
+ validation {
1326
+ condition = contains(["row", "sidecar"], var.analyst_policy_source)
1327
+ error_message = "analyst_policy_source must be 'row' or 'sidecar'."
1328
+ }
1329
+ }
1330
+
1585
1331
  variable "compliance_anchor_retention_days" {
1586
1332
  description = "Default Object Lock retention in days for the compliance audit-anchor bucket. SOC2 Type 1 baseline is 12 months (365)."
1587
1333
  type = number
@@ -72,6 +72,8 @@ type ThreadActivityEvent {
72
72
  snippet: String
73
73
  threadTitle: String
74
74
  createdAt: AWSDateTime
75
+ mentioned: Boolean
76
+ shouldNotify: Boolean
75
77
  }
76
78
 
77
79
  type InboxItemStatusEvent {
@@ -205,6 +207,8 @@ type Mutation {
205
207
  snippet: String
206
208
  threadTitle: String
207
209
  createdAt: AWSDateTime
210
+ mentioned: Boolean
211
+ shouldNotify: Boolean
208
212
  ): ThreadActivityEvent @aws_api_key @aws_cognito_user_pools @aws_iam
209
213
 
210
214
  notifyInboxItemUpdate(