thinkwork-cli 0.12.16 → 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 (149) hide show
  1. package/dist/cli.js +517 -10403
  2. package/dist/commands/enterprise/templates/deploy-repo/docs/runbook.md +3 -8
  3. package/dist/commands/enterprise/templates/deploy-repo/terraform/main.tf +1 -184
  4. package/dist/drizzle/0050_brain_v0_entity_subtype.sql +2 -2
  5. package/dist/drizzle/0051_brain_v0_tenant_entity_pages.sql +6 -6
  6. package/dist/drizzle/0052_brain_v0_external_refs.sql +2 -2
  7. package/dist/drizzle/0053_brain_v0_unresolved_mentions_subtype.sql +2 -2
  8. package/dist/drizzle/0145_knowledge_graph_thread_ingest.sql +14 -14
  9. package/dist/drizzle/0146_knowledge_graph_source_scope.sql +1 -1
  10. package/dist/drizzle/0157_knowledge_graph_observations_source.sql +2 -2
  11. package/dist/drizzle/0158_wiki_tenant_scope.sql +1 -1
  12. package/dist/drizzle/0165_plugin_premium_entitlements.sql +2 -2
  13. package/dist/drizzle/{0166_company_brain_substrate_contract.sql → 0166_brain_substrate_contract.sql} +9 -9
  14. package/dist/drizzle/{0167_company_brain_artifact_manifest_runtime.sql → 0167_brain_artifact_manifest_runtime.sql} +5 -5
  15. package/dist/drizzle/0168_eval_skill_gate.sql +1 -1
  16. package/dist/drizzle/0183_okf_artifact_manifests.sql +1 -1
  17. package/dist/drizzle/0200_eval_results_execution_tier.sql +40 -0
  18. package/dist/drizzle/0201_brain_dream_runs.sql +72 -0
  19. package/dist/drizzle/0202_backfill_thread_participants_from_senders.sql +110 -0
  20. package/dist/drizzle/0203_threads_mode_override.sql +61 -0
  21. package/dist/drizzle/0204_thread_turns_triggering_message_id.sql +48 -0
  22. package/dist/drizzle/0205_routines_git_python.sql +185 -0
  23. package/dist/drizzle/0206_agent_loop_versions_routine_actions.sql +40 -0
  24. package/dist/drizzle/0207_tenant_credentials_github_repo_kind.sql +52 -0
  25. package/dist/drizzle/0208_knowledge_graph_neutral_identifiers.sql +253 -0
  26. package/dist/drizzle/0209_living_artifacts_schema.sql +109 -0
  27. package/dist/drizzle/0210_think137_automations_additive_schema.sql +113 -0
  28. package/dist/drizzle/0211_backfill_agent_loop_versions_target_spec.sql +120 -0
  29. package/dist/drizzle/0212_fold_webhooks_into_automations.sql +312 -0
  30. package/dist/drizzle/0213_agent_loop_versions_judge_evidence_nullable.sql +63 -0
  31. package/dist/drizzle/0214_think137_drop_judge_evidence_roi.sql +99 -0
  32. package/dist/drizzle/0215_agent_loop_versions_goal_worker_policy_nullable.sql +70 -0
  33. package/dist/drizzle/0216_drop_agent_loop_versions_goal_worker_policy.sql +81 -0
  34. package/dist/drizzle/0217_agents_capability_folder_dispatch.sql +12 -0
  35. package/dist/drizzle/0218_document_plates.sql +30 -0
  36. package/dist/drizzle/0219_document_section_waivers.sql +29 -0
  37. package/dist/drizzle/0220_artifacts_created_by_user.sql +21 -0
  38. package/dist/drizzle/0221_artifact_shares.sql +29 -0
  39. package/dist/drizzle/0221_workflow_interpreter_thin_slice.sql +71 -0
  40. package/dist/drizzle/0222_compliance_drainer_select_audit_events.sql +21 -0
  41. package/dist/drizzle/0223_document_conformance_reports.sql +38 -0
  42. package/dist/drizzle/0224_artifact_refresh_state.sql +11 -0
  43. package/dist/drizzle/0225_think216_agent_loop_convergence.sql +21 -0
  44. package/dist/drizzle/0226_drop_n8n_agent_step_runs.sql +6 -0
  45. package/dist/drizzle/0227_analyst_reader_role.sql +1055 -0
  46. package/dist/drizzle/0228_tenant_credentials_rds_iam_kind.sql +62 -0
  47. package/dist/drizzle/0229_analyst_reader_rds_iam_grant.sql +79 -0
  48. package/dist/drizzle/0230_analyst_rls.sql +1613 -0
  49. package/dist/drizzle/0231_cost_events_cache_write_enforcement_exempt.sql +11 -0
  50. package/dist/plugins/catalog/package.json +0 -1
  51. package/dist/plugins/catalog/src/__tests__/build-catalog.test.ts +0 -1
  52. package/dist/plugins/catalog/src/__tests__/catalog.test.ts +16 -8
  53. package/dist/plugins/catalog/src/__tests__/contracts.test.ts +56 -0
  54. package/dist/plugins/catalog/src/__tests__/plugin-package.test.ts +0 -2
  55. package/dist/plugins/catalog/src/__tests__/plugin-registry.test.ts +0 -5
  56. package/dist/plugins/catalog/src/contracts.ts +112 -0
  57. package/dist/plugins/catalog/src/registry/generated-first-party.ts +0 -6
  58. package/dist/plugins/n8n/README.md +4 -36
  59. package/dist/plugins/n8n/src/deployment/managed-app.ts +0 -17
  60. package/dist/plugins/n8n/src/manifest.ts +0 -5
  61. package/dist/plugins/n8n/terraform/n8n/main.tf +0 -26
  62. package/dist/plugins/n8n/terraform/n8n/outputs.tf +0 -5
  63. package/dist/plugins/n8n/terraform/n8n/variables.tf +0 -6
  64. package/dist/plugins/n8n/test/manifest.test.ts +0 -1
  65. package/dist/plugins/twenty/package.json +5 -0
  66. package/dist/plugins/twenty/scripts/lib/__tests__/load-records.test.ts +232 -0
  67. package/dist/plugins/twenty/scripts/lib/__tests__/mappers.test.ts +489 -0
  68. package/dist/plugins/twenty/scripts/lib/__tests__/members-ensure.test.ts +199 -0
  69. package/dist/plugins/twenty/scripts/lib/__tests__/provision-members-db.test.ts +43 -0
  70. package/dist/plugins/twenty/scripts/lib/__tests__/schema-ensure.test.ts +230 -0
  71. package/dist/plugins/twenty/scripts/lib/__tests__/twenty-client.test.ts +207 -0
  72. package/dist/plugins/twenty/scripts/lib/lastmile-reader.ts +282 -0
  73. package/dist/plugins/twenty/scripts/lib/load-attachments.ts +220 -0
  74. package/dist/plugins/twenty/scripts/lib/load-records.ts +680 -0
  75. package/dist/plugins/twenty/scripts/lib/mappers.ts +559 -0
  76. package/dist/plugins/twenty/scripts/lib/members-ensure.ts +381 -0
  77. package/dist/plugins/twenty/scripts/lib/provision-members-db.ts +191 -0
  78. package/dist/plugins/twenty/scripts/lib/schema-ensure.ts +425 -0
  79. package/dist/plugins/twenty/scripts/lib/twenty-client.ts +246 -0
  80. package/dist/plugins/twenty/scripts/migrate-lastmile.ts +610 -0
  81. package/dist/plugins/twenty/scripts/provision-twenty-members.ts +214 -0
  82. package/dist/plugins/twenty/src/manifest.ts +99 -0
  83. package/dist/plugins/twenty/terraform/twenty/README.md +1 -1
  84. package/dist/plugins/twenty/test/manifest.test.ts +12 -2
  85. package/dist/terraform/examples/greenfield/main.tf +90 -380
  86. package/dist/terraform/examples/greenfield/terraform.tfvars.example +0 -1
  87. package/dist/terraform/modules/app/agentcore-pi/README.md +1 -3
  88. package/dist/terraform/modules/app/agentcore-pi/main.tf +29 -38
  89. package/dist/terraform/modules/app/agentcore-pi/variables.tf +23 -15
  90. package/dist/terraform/modules/app/agentcore-runtime/main.tf +3 -3
  91. package/dist/terraform/modules/app/customer-domain/main.tf +16 -2
  92. package/dist/terraform/modules/app/deployment-control-plane/main.tf +5 -0
  93. package/dist/terraform/modules/app/deployment-control-plane/runner.py +85 -207
  94. package/dist/terraform/modules/app/deployment-control-plane/test_runner_bundle.py +56 -2
  95. package/dist/terraform/modules/app/hindsight-memory/main.tf +52 -4
  96. package/dist/terraform/modules/app/lambda-api/eval-fanout.tf +7 -0
  97. package/dist/terraform/modules/app/lambda-api/handlers.tf +493 -89
  98. package/dist/terraform/modules/app/lambda-api/iam-grouped.tf +215 -96
  99. package/dist/terraform/modules/app/lambda-api/main.tf +24 -5
  100. package/dist/terraform/modules/app/lambda-api/outputs.tf +19 -11
  101. package/dist/terraform/modules/app/lambda-api/variables.tf +94 -67
  102. package/dist/terraform/modules/app/ses-email/main.tf +14 -2
  103. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/main.tf +493 -0
  104. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/outputs.tf +34 -0
  105. package/dist/terraform/modules/app/workflow-interpreter-stepfunctions/variables.tf +32 -0
  106. package/dist/terraform/modules/data/aurora-postgres/main.tf +55 -0
  107. package/dist/terraform/modules/data/aurora-postgres/outputs.tf +15 -0
  108. package/dist/terraform/modules/data/s3-buckets/main.tf +26 -0
  109. package/dist/terraform/modules/thinkwork/README.md +0 -1
  110. package/dist/terraform/modules/thinkwork/main.tf +167 -446
  111. package/dist/terraform/modules/thinkwork/outputs.tf +2 -142
  112. package/dist/terraform/modules/thinkwork/variables.tf +55 -309
  113. package/dist/terraform/schema.graphql +4 -0
  114. package/dist/workspace-defaults/files/AGENTS.md +45 -31
  115. package/dist/workspace-defaults/files/CONTEXT.md +48 -4
  116. package/dist/workspace-defaults/files/GUARDRAILS.md +18 -0
  117. package/dist/workspace-defaults/files/MEMORY_GUIDE.md +32 -4
  118. package/dist/workspace-defaults/files/SPACE.md +34 -19
  119. package/dist/workspace-defaults/files/TOOLS.md +30 -0
  120. package/dist/workspace-defaults/files/skills/document-composer/SKILL.md +154 -0
  121. package/dist/workspace-defaults/files/skills/document-composer/references/authoring-rules.md +101 -0
  122. package/package.json +1 -1
  123. package/dist/plugins/company-brain/README.md +0 -37
  124. package/dist/plugins/company-brain/package.json +0 -33
  125. package/dist/plugins/company-brain/runtime/cognee/Dockerfile +0 -11
  126. package/dist/plugins/company-brain/smoke/cognee-managed-app-smoke.mjs +0 -458
  127. package/dist/plugins/company-brain/smoke/cognee-memory-cutover-smoke.mjs +0 -539
  128. package/dist/plugins/company-brain/smoke/company-brain-context-engine-smoke.mjs +0 -312
  129. package/dist/plugins/company-brain/smoke/company-brain-operations-smoke.mjs +0 -449
  130. package/dist/plugins/company-brain/smoke/company-brain-plugin-smoke.mjs +0 -655
  131. package/dist/plugins/company-brain/smoke/hindsight-memory-isolation-smoke.mjs +0 -474
  132. package/dist/plugins/company-brain/src/api/cognee-client.ts +0 -896
  133. package/dist/plugins/company-brain/src/api/cognee-cluster-identity.ts +0 -49
  134. package/dist/plugins/company-brain/src/api/cognee-memory-scope.ts +0 -84
  135. package/dist/plugins/company-brain/src/api/context-engine-provider.ts +0 -888
  136. package/dist/plugins/company-brain/src/api/migration.ts +0 -665
  137. package/dist/plugins/company-brain/src/deployment/cognee-managed-app.ts +0 -396
  138. package/dist/plugins/company-brain/src/index.ts +0 -62
  139. package/dist/plugins/company-brain/src/manifest.ts +0 -112
  140. package/dist/plugins/company-brain/terraform/cognee/README.md +0 -263
  141. package/dist/plugins/company-brain/terraform/cognee/main.tf +0 -766
  142. package/dist/plugins/company-brain/terraform/cognee/outputs.tf +0 -144
  143. package/dist/plugins/company-brain/terraform/cognee/variables.tf +0 -402
  144. package/dist/plugins/company-brain/test/api/cognee-client.test.ts +0 -562
  145. package/dist/plugins/company-brain/test/api/cognee-memory-scope.test.ts +0 -74
  146. package/dist/plugins/company-brain/test/api/context-engine-provider.test.ts +0 -447
  147. package/dist/plugins/company-brain/test/api/migration.test.ts +0 -465
  148. package/dist/plugins/company-brain/test/manifest.test.ts +0 -95
  149. package/dist/plugins/company-brain/tsconfig.json +0 -8
@@ -185,20 +185,15 @@ It must not include secrets.
185
185
  Run managed-app smokes after deploy, destroy, park, or release upgrade jobs:
186
186
 
187
187
  ```bash
188
- SMOKE_ENABLE_COGNEE_MANAGED_APP=1 \
189
- SMOKE_TENANT_ID=<tenant-id> \
190
- SMOKE_EVIDENCE_FILE=deploy-artifacts/cognee-smoke.json \
191
- node plugins/company-brain/smoke/cognee-managed-app-smoke.mjs
192
-
193
188
  SMOKE_ENABLE_TWENTY_MANAGED_APP=1 \
194
189
  SMOKE_TENANT_ID=<tenant-id> \
195
190
  SMOKE_EVIDENCE_FILE=deploy-artifacts/twenty-smoke.json \
196
191
  node plugins/twenty/smoke/twenty-managed-app-smoke.mjs
197
192
  ```
198
193
 
199
- Cognee and Twenty smokes skip with explicit evidence when the app is not
200
- enabled, unprovisioned, or parked. A skipped smoke is valid evidence only when
201
- that app state is intentional for the stage.
194
+ Twenty smokes skip with explicit evidence when the app is not enabled,
195
+ unprovisioned, or parked. A skipped smoke is valid evidence only when that app
196
+ state is intentional for the stage.
202
197
 
203
198
  ## Workflow Components
204
199
 
@@ -70,162 +70,12 @@ variable "enable_hindsight" {
70
70
  default = true
71
71
  }
72
72
 
73
- variable "enable_cognee" {
74
- description = "Enable Cognee as optional ThinkWork Brain ontology/knowledge-graph infrastructure. Disabled by default."
75
- type = bool
76
- default = false
77
- }
78
-
79
73
  variable "memory_engine" {
80
- description = "Active long-term memory engine. Empty selects Hindsight when enable_hindsight = true. Use 'agentcore' only for explicit low-cost/development managed-memory deployments; 'cognee' is legacy diagnostic compatibility, not the supported user/Space memory path."
81
- type = string
82
- default = ""
83
- }
84
-
85
- variable "cognee_image_uri" {
86
- description = "Cognee container image URI pinned to an immutable sha256 digest. Required when enable_cognee = true."
87
- type = string
88
- default = ""
89
- }
90
-
91
- variable "cognee_db_username" {
92
- description = "Dedicated PostgreSQL username for Cognee metadata storage."
93
- type = string
94
- default = "thinkwork_cognee"
95
- }
96
-
97
- variable "cognee_db_name" {
98
- description = "Dedicated PostgreSQL database name for Cognee metadata storage."
99
- type = string
100
- default = "thinkwork_cognee"
101
- }
102
-
103
- variable "cognee_db_password_secret_arn" {
104
- description = "Secrets Manager ARN containing a JSON password field for the dedicated Cognee PostgreSQL user. Required when enable_cognee = true."
105
- type = string
106
- default = ""
107
- }
108
-
109
- variable "cognee_allowed_internal_cidr_blocks" {
110
- description = "CIDR blocks allowed to reach the internal Cognee ALB."
111
- type = list(string)
112
- default = []
113
- }
114
-
115
- variable "cognee_allowed_internal_security_group_ids" {
116
- description = "Security group IDs allowed to reach the internal Cognee ALB."
117
- type = list(string)
118
- default = []
119
- }
120
-
121
- variable "cognee_backend_mode" {
122
- description = "Cognee backend mode. dogfood uses EFS-backed local stores; remote requires graph/vector URLs."
123
- type = string
124
- default = "dogfood"
125
- }
126
-
127
- variable "cognee_desired_count" {
128
- description = "Desired Cognee task count. Dogfood mode must stay at 1."
129
- type = number
130
- default = 1
131
- }
132
-
133
- variable "cognee_llm_provider" {
134
- description = "Cognee LLM provider."
135
- type = string
136
- default = "bedrock"
137
- }
138
-
139
- variable "cognee_llm_model" {
140
- description = "Cognee LLM model."
141
- type = string
142
- default = "bedrock/amazon.nova-lite-v1:0"
143
- }
144
-
145
- variable "cognee_llm_api_key_secret_arn" {
146
- description = "Optional Secrets Manager ARN for non-Bedrock Cognee LLM provider API key."
74
+ description = "Active long-term memory engine. Empty selects Hindsight when enable_hindsight = true. Use 'agentcore' only for explicit low-cost/development managed-memory deployments."
147
75
  type = string
148
76
  default = ""
149
77
  }
150
78
 
151
- variable "cognee_embedding_provider" {
152
- description = "Cognee embedding provider."
153
- type = string
154
- default = "bedrock"
155
- }
156
-
157
- variable "cognee_embedding_model" {
158
- description = "Cognee embedding model."
159
- type = string
160
- default = "amazon.titan-embed-text-v2:0"
161
- }
162
-
163
- variable "cognee_embedding_dimensions" {
164
- description = "Cognee embedding dimensions."
165
- type = number
166
- default = 1024
167
- }
168
-
169
- variable "cognee_embedding_api_key_secret_arn" {
170
- description = "Optional Secrets Manager ARN for non-Bedrock Cognee embedding provider API key."
171
- type = string
172
- default = ""
173
- }
174
-
175
- variable "cognee_vector_db_provider" {
176
- description = "Cognee vector store provider."
177
- type = string
178
- default = "lancedb"
179
- }
180
-
181
- variable "cognee_vector_db_url" {
182
- description = "Cognee vector store URL. Empty uses the dogfood local default."
183
- type = string
184
- default = ""
185
- }
186
-
187
- variable "cognee_vector_db_key_secret_arn" {
188
- description = "Optional Secrets Manager ARN for remote Cognee vector store credentials."
189
- type = string
190
- default = ""
191
- }
192
-
193
- variable "cognee_graph_database_provider" {
194
- description = "Cognee graph store provider."
195
- type = string
196
- default = "kuzu"
197
- }
198
-
199
- variable "cognee_graph_database_url" {
200
- description = "Cognee graph store URL. Empty uses the dogfood local default."
201
- type = string
202
- default = ""
203
- }
204
-
205
- variable "cognee_graph_database_username" {
206
- description = "Optional Cognee graph store username."
207
- type = string
208
- default = ""
209
- }
210
-
211
- variable "cognee_graph_database_password_secret_arn" {
212
- description = "Optional Secrets Manager ARN for remote Cognee graph store password."
213
- type = string
214
- default = ""
215
- }
216
-
217
- variable "cognee_bedrock_model_resource_arns" {
218
- description = "Explicit Bedrock model ARNs Cognee may invoke when a Bedrock provider is selected."
219
- type = list(string)
220
- default = []
221
- }
222
-
223
- variable "cognee_kms_key_arns" {
224
- description = "Optional KMS key ARNs needed to decrypt Cognee-injected secrets."
225
- type = list(string)
226
- default = []
227
- }
228
-
229
79
  variable "twenty_provisioned" {
230
80
  description = "Provision the retained Twenty CRM managed-app substrate. Runtime can be parked independently with twenty_runtime_enabled."
231
81
  type = bool
@@ -316,31 +166,6 @@ module "thinkwork" {
316
166
 
317
167
  enable_hindsight = var.enable_hindsight
318
168
  memory_engine = var.memory_engine
319
- enable_cognee = var.enable_cognee
320
- cognee_image_uri = var.cognee_image_uri
321
- cognee_db_username = var.cognee_db_username
322
- cognee_db_name = var.cognee_db_name
323
- cognee_db_password_secret_arn = var.cognee_db_password_secret_arn
324
- cognee_allowed_internal_cidr_blocks = var.cognee_allowed_internal_cidr_blocks
325
- cognee_allowed_internal_security_group_ids = var.cognee_allowed_internal_security_group_ids
326
- cognee_backend_mode = var.cognee_backend_mode
327
- cognee_desired_count = var.cognee_desired_count
328
- cognee_llm_provider = var.cognee_llm_provider
329
- cognee_llm_model = var.cognee_llm_model
330
- cognee_llm_api_key_secret_arn = var.cognee_llm_api_key_secret_arn
331
- cognee_embedding_provider = var.cognee_embedding_provider
332
- cognee_embedding_model = var.cognee_embedding_model
333
- cognee_embedding_dimensions = var.cognee_embedding_dimensions
334
- cognee_embedding_api_key_secret_arn = var.cognee_embedding_api_key_secret_arn
335
- cognee_vector_db_provider = var.cognee_vector_db_provider
336
- cognee_vector_db_url = var.cognee_vector_db_url
337
- cognee_vector_db_key_secret_arn = var.cognee_vector_db_key_secret_arn
338
- cognee_graph_database_provider = var.cognee_graph_database_provider
339
- cognee_graph_database_url = var.cognee_graph_database_url
340
- cognee_graph_database_username = var.cognee_graph_database_username
341
- cognee_graph_database_password_secret_arn = var.cognee_graph_database_password_secret_arn
342
- cognee_bedrock_model_resource_arns = var.cognee_bedrock_model_resource_arns
343
- cognee_kms_key_arns = var.cognee_kms_key_arns
344
169
  twenty_provisioned = var.twenty_provisioned
345
170
  twenty_runtime_enabled = var.twenty_runtime_enabled
346
171
  twenty_image_uri = var.twenty_image_uri
@@ -366,14 +191,6 @@ output "lambda_artifact_mode" {
366
191
  value = module.thinkwork.lambda_artifact_mode
367
192
  }
368
193
 
369
- output "cognee_enabled" {
370
- value = module.thinkwork.cognee_enabled
371
- }
372
-
373
- output "cognee_endpoint" {
374
- value = module.thinkwork.cognee_endpoint
375
- }
376
-
377
194
  output "twenty_provisioned" {
378
195
  value = module.thinkwork.twenty_provisioned
379
196
  }
@@ -1,7 +1,7 @@
1
1
  -- Brain v0 entity subtype foundation.
2
2
  --
3
3
  -- Plan:
4
- -- docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md
4
+ -- docs/plans/2026-04-29-004-feat-brain-v0-plan.md
5
5
  --
6
6
  -- Apply manually:
7
7
  -- psql "$DATABASE_URL" -f packages/database-pg/drizzle/0050_brain_v0_entity_subtype.sql
@@ -24,6 +24,6 @@ CREATE INDEX IF NOT EXISTS idx_wiki_pages_entity_subtype
24
24
  WHERE entity_subtype IS NOT NULL;
25
25
 
26
26
  COMMENT ON COLUMN public.wiki_pages.entity_subtype
27
- IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
27
+ IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
28
28
 
29
29
  COMMIT;
@@ -1,7 +1,7 @@
1
1
  -- Brain v0 tenant-shared entity pages.
2
2
  --
3
3
  -- Plan:
4
- -- docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md
4
+ -- docs/plans/2026-04-29-004-feat-brain-v0-plan.md
5
5
  --
6
6
  -- Apply manually:
7
7
  -- psql "$DATABASE_URL" -f packages/database-pg/drizzle/0051_brain_v0_tenant_entity_pages.sql
@@ -161,10 +161,10 @@ CREATE TRIGGER trg_tenant_entity_section_sources_tenant
161
161
  FOR EACH ROW
162
162
  EXECUTE FUNCTION public.enforce_tenant_entity_section_source_tenant();
163
163
 
164
- COMMENT ON TABLE public.tenant_entity_pages IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
165
- COMMENT ON TABLE public.tenant_entity_page_sections IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
166
- COMMENT ON TABLE public.tenant_entity_page_links IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
167
- COMMENT ON TABLE public.tenant_entity_page_aliases IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
168
- COMMENT ON TABLE public.tenant_entity_section_sources IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
164
+ COMMENT ON TABLE public.tenant_entity_pages IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
165
+ COMMENT ON TABLE public.tenant_entity_page_sections IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
166
+ COMMENT ON TABLE public.tenant_entity_page_links IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
167
+ COMMENT ON TABLE public.tenant_entity_page_aliases IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
168
+ COMMENT ON TABLE public.tenant_entity_section_sources IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
169
169
 
170
170
  COMMIT;
@@ -1,7 +1,7 @@
1
1
  -- Brain v0 operational snapshot cache for tenant entities.
2
2
  --
3
3
  -- Plan:
4
- -- docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md
4
+ -- docs/plans/2026-04-29-004-feat-brain-v0-plan.md
5
5
  --
6
6
  -- Apply manually:
7
7
  -- psql "$DATABASE_URL" -f packages/database-pg/drizzle/0052_brain_v0_external_refs.sql
@@ -36,6 +36,6 @@ CREATE UNIQUE INDEX IF NOT EXISTS uq_tenant_entity_external_refs_source
36
36
  CREATE INDEX IF NOT EXISTS idx_tenant_entity_external_refs_tenant_source
37
37
  ON public.tenant_entity_external_refs (tenant_id, source_kind);
38
38
 
39
- COMMENT ON TABLE public.tenant_entity_external_refs IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
39
+ COMMENT ON TABLE public.tenant_entity_external_refs IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
40
40
 
41
41
  COMMIT;
@@ -1,7 +1,7 @@
1
1
  -- Brain v0 subtype suggestion for unresolved mentions.
2
2
  --
3
3
  -- Plan:
4
- -- docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md
4
+ -- docs/plans/2026-04-29-004-feat-brain-v0-plan.md
5
5
  --
6
6
  -- Apply manually:
7
7
  -- psql "$DATABASE_URL" -f packages/database-pg/drizzle/0053_brain_v0_unresolved_mentions_subtype.sql
@@ -43,6 +43,6 @@ BEGIN
43
43
  END $$;
44
44
 
45
45
  COMMENT ON COLUMN public.wiki_unresolved_mentions.entity_subtype
46
- IS 'brain-v0: docs/plans/2026-04-29-004-feat-company-brain-v0-plan.md';
46
+ IS 'brain-v0: docs/plans/2026-04-29-004-feat-brain-v0-plan.md';
47
47
 
48
48
  COMMIT;
@@ -1,5 +1,5 @@
1
- -- Purpose: add Cognee thread ingest run ledger and normalized graph snapshot tables.
2
- -- Plan: docs/plans/2026-06-04-003-feat-cognee-thread-ingest-explorer-plan.md (U1)
1
+ -- Purpose: add Knowledge Graph thread ingest run ledger and normalized graph snapshot tables.
2
+ -- Plan: 2026-06-04-003 U1
3
3
  -- Apply manually: psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0145_knowledge_graph_thread_ingest.sql
4
4
  -- creates: public.knowledge_graph_ingest_runs
5
5
  -- creates: public.knowledge_graph_entities
@@ -9,12 +9,12 @@
9
9
  -- creates: public.idx_kg_ingest_runs_tenant_status
10
10
  -- creates: public.idx_kg_ingest_runs_requested_by
11
11
  -- creates: public.uq_kg_ingest_runs_active_thread
12
- -- creates: public.uq_kg_entities_run_cognee_node
12
+ -- creates: public.uq_kg_entities_run_graph_node
13
13
  -- creates: public.idx_kg_entities_tenant_thread_label
14
14
  -- creates: public.idx_kg_entities_tenant_thread_type
15
15
  -- creates: public.idx_kg_entities_tenant_thread_trust
16
16
  -- creates: public.idx_kg_entities_label_trgm
17
- -- creates: public.uq_kg_relationships_run_cognee_edge
17
+ -- creates: public.uq_kg_relationships_run_graph_edge
18
18
  -- creates: public.idx_kg_relationships_tenant_thread_source
19
19
  -- creates: public.idx_kg_relationships_tenant_thread_target
20
20
  -- creates: public.idx_kg_relationships_tenant_thread_type
@@ -72,8 +72,8 @@ CREATE TABLE IF NOT EXISTS public.knowledge_graph_ingest_runs (
72
72
  requested_by_user_id uuid,
73
73
  status text NOT NULL DEFAULT 'queued',
74
74
  trigger text NOT NULL DEFAULT 'manual',
75
- cognee_dataset_name text NOT NULL,
76
- cognee_dataset_id text,
75
+ source_dataset_name text NOT NULL,
76
+ source_dataset_id text,
77
77
  started_at timestamptz,
78
78
  finished_at timestamptz,
79
79
  duration_ms integer,
@@ -124,7 +124,7 @@ CREATE TABLE IF NOT EXISTS public.knowledge_graph_entities (
124
124
  tenant_id uuid NOT NULL,
125
125
  thread_id uuid NOT NULL,
126
126
  ingest_run_id uuid NOT NULL,
127
- cognee_node_id text NOT NULL,
127
+ graph_node_id text NOT NULL,
128
128
  label text NOT NULL,
129
129
  normalized_label text NOT NULL,
130
130
  type_label text,
@@ -163,8 +163,8 @@ CREATE TABLE IF NOT EXISTS public.knowledge_graph_entities (
163
163
  CHECK (provenance_status IN ('strong', 'weak', 'missing'))
164
164
  );
165
165
 
166
- CREATE UNIQUE INDEX IF NOT EXISTS uq_kg_entities_run_cognee_node
167
- ON public.knowledge_graph_entities (ingest_run_id, cognee_node_id);
166
+ CREATE UNIQUE INDEX IF NOT EXISTS uq_kg_entities_run_graph_node
167
+ ON public.knowledge_graph_entities (ingest_run_id, graph_node_id);
168
168
 
169
169
  CREATE INDEX IF NOT EXISTS idx_kg_entities_tenant_thread_label
170
170
  ON public.knowledge_graph_entities (tenant_id, thread_id, normalized_label);
@@ -188,7 +188,7 @@ CREATE TABLE IF NOT EXISTS public.knowledge_graph_relationships (
188
188
  tenant_id uuid NOT NULL,
189
189
  thread_id uuid NOT NULL,
190
190
  ingest_run_id uuid NOT NULL,
191
- cognee_edge_id text,
191
+ graph_edge_id text,
192
192
  source_entity_id uuid NOT NULL,
193
193
  target_entity_id uuid NOT NULL,
194
194
  label text NOT NULL,
@@ -233,9 +233,9 @@ CREATE TABLE IF NOT EXISTS public.knowledge_graph_relationships (
233
233
  CHECK (provenance_status IN ('strong', 'weak', 'missing'))
234
234
  );
235
235
 
236
- CREATE UNIQUE INDEX IF NOT EXISTS uq_kg_relationships_run_cognee_edge
237
- ON public.knowledge_graph_relationships (ingest_run_id, cognee_edge_id)
238
- WHERE cognee_edge_id IS NOT NULL;
236
+ CREATE UNIQUE INDEX IF NOT EXISTS uq_kg_relationships_run_graph_edge
237
+ ON public.knowledge_graph_relationships (ingest_run_id, graph_edge_id)
238
+ WHERE graph_edge_id IS NOT NULL;
239
239
 
240
240
  CREATE INDEX IF NOT EXISTS idx_kg_relationships_tenant_thread_source
241
241
  ON public.knowledge_graph_relationships (tenant_id, thread_id, source_entity_id);
@@ -298,7 +298,7 @@ CREATE TABLE IF NOT EXISTS public.knowledge_graph_evidence (
298
298
  REFERENCES public.messages(id)
299
299
  ON DELETE SET NULL,
300
300
  CONSTRAINT knowledge_graph_evidence_source_kind_allowed
301
- CHECK (source_kind IN ('thread_message', 'cognee_payload', 'normalizer')),
301
+ CHECK (source_kind IN ('thread_message', 'graph_payload', 'normalizer')),
302
302
  CONSTRAINT knowledge_graph_evidence_subject_required
303
303
  CHECK (entity_id IS NOT NULL OR relationship_id IS NOT NULL)
304
304
  );
@@ -166,7 +166,7 @@ ALTER TABLE public.knowledge_graph_evidence
166
166
  ADD CONSTRAINT knowledge_graph_evidence_source_kind_allowed
167
167
  CHECK (source_kind IN ('thread','wiki','brain')),
168
168
  ADD CONSTRAINT knowledge_graph_evidence_evidence_source_kind_allowed
169
- CHECK (evidence_source_kind IN ('thread_message','wiki_page','wiki_section','brain_page','brain_section','cognee_payload','normalizer'));
169
+ CHECK (evidence_source_kind IN ('thread_message','wiki_page','wiki_section','brain_page','brain_section','graph_payload','normalizer'));
170
170
 
171
171
  CREATE OR REPLACE FUNCTION public.enforce_knowledge_graph_ingest_run_scope()
172
172
  RETURNS trigger
@@ -1,6 +1,6 @@
1
1
  -- Purpose: admit Hindsight observations as a Knowledge Graph ingest source and
2
2
  -- add per-(tenant, bank) incremental cursors for the tenant fan-in.
3
- -- Plan: docs/plans/2026-06-09-004-feat-cognee-centric-memory-pipeline-plan.md (U4)
3
+ -- Plan: 2026-06-09-004 U4
4
4
  -- Apply manually: psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0157_knowledge_graph_observations_source.sql
5
5
  -- creates: public.knowledge_graph_observation_cursors
6
6
  -- creates: public.uq_kg_observation_cursors_tenant_bank
@@ -56,7 +56,7 @@ ALTER TABLE public.knowledge_graph_evidence
56
56
  DROP CONSTRAINT IF EXISTS knowledge_graph_evidence_evidence_source_kind_allowed;
57
57
  ALTER TABLE public.knowledge_graph_evidence
58
58
  ADD CONSTRAINT knowledge_graph_evidence_evidence_source_kind_allowed
59
- CHECK (evidence_source_kind IN ('thread_message','wiki_page','wiki_section','brain_page','brain_section','hindsight_observation','cognee_payload','normalizer'));
59
+ CHECK (evidence_source_kind IN ('thread_message','wiki_page','wiki_section','brain_page','brain_section','hindsight_observation','graph_payload','normalizer'));
60
60
 
61
61
  -- Per-(tenant, bank) cursors for the observations fan-in. The
62
62
  -- (last_record_updated_at, last_record_id) pair mirrors the wiki compile
@@ -7,7 +7,7 @@
7
7
  -- Purely additive: nothing drops, no data changes. User-scoped
8
8
  -- pages keep their owner_id; the U11 cutover archive pass is a
9
9
  -- separate, later migration.
10
- -- Plan: docs/plans/2026-06-09-004-feat-cognee-centric-memory-pipeline-plan.md (U9)
10
+ -- Plan: 2026-06-09-004 U9
11
11
  -- Apply manually: psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0158_wiki_tenant_scope.sql
12
12
  -- creates: wiki.uq_pages_tenant_type_slug_tenant_scope
13
13
  -- Note: the two ALTER COLUMN ... DROP NOT NULL statements (wiki.pages.owner_id,
@@ -1,8 +1,8 @@
1
1
  -- Purpose: add generic premium plugin entitlement and one-time install-key
2
- -- storage for Company Brain and future premium plugins. Entitlements are
2
+ -- storage for ThinkWork Brain and future premium plugins. Entitlements are
3
3
  -- persistent tenant/plugin grants independent of install state; install keys
4
4
  -- store digests only and can be redeemed once into an entitlement.
5
- -- Plan: docs/plans/2026-06-13-002-feat-company-brain-premium-plugin-plan.md U2
5
+ -- Plan: docs/plans/2026-06-13-002-feat-brain-premium-plugin-plan.md U2
6
6
  -- Apply manually (no CI migration runner):
7
7
  -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0165_plugin_premium_entitlements.sql
8
8
  -- Pre-flight:
@@ -1,9 +1,9 @@
1
- -- Purpose: add the Company Brain substrate contract tables used to report
1
+ -- Purpose: add the ThinkWork Brain substrate contract tables used to report
2
2
  -- storage tier, backend posture, migration state, operational counters, and
3
3
  -- replayable artifact manifests.
4
- -- Plan: docs/plans/2026-06-13-003-feat-company-brain-physical-substrate-plan.md U1
4
+ -- Plan: docs/plans/2026-06-13-003-feat-brain-physical-substrate-plan.md U1
5
5
  -- Apply manually (no CI migration runner):
6
- -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0166_company_brain_substrate_contract.sql
6
+ -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0166_brain_substrate_contract.sql
7
7
  -- Pre-flight:
8
8
  -- SELECT to_regclass('brain.substrate_states');
9
9
  -- SELECT to_regclass('public.managed_applications');
@@ -76,12 +76,12 @@
76
76
  SET lock_timeout = '5s';
77
77
  SET statement_timeout = '15min';
78
78
 
79
- SELECT pg_advisory_lock(hashtext('migration:0166_company_brain_substrate_contract'));
79
+ SELECT pg_advisory_lock(hashtext('migration:0166_brain_substrate_contract'));
80
80
 
81
81
  CREATE SCHEMA IF NOT EXISTS brain;
82
82
 
83
83
  -- ---------------------------------------------------------------------------
84
- -- brain.substrate_states — per-tenant Company Brain substrate posture
84
+ -- brain.substrate_states — per-tenant Brain substrate posture
85
85
  -- ---------------------------------------------------------------------------
86
86
 
87
87
  CREATE TABLE IF NOT EXISTS brain.substrate_states (
@@ -98,8 +98,8 @@ CREATE TABLE IF NOT EXISTS brain.substrate_states (
98
98
  vector_provider text,
99
99
  embedding_model text,
100
100
  vector_dimension integer,
101
- cognee_version text,
102
- cognee_endpoint text,
101
+ substrate_version text,
102
+ substrate_endpoint text,
103
103
  s3_artifact_root text,
104
104
  s3_manifest_root text,
105
105
  s3_vault_projection_root text,
@@ -138,7 +138,7 @@ CREATE TABLE IF NOT EXISTS brain.substrate_states (
138
138
  CONSTRAINT brain_substrate_states_tier_allowed
139
139
  CHECK (storage_tier IN ('default', 'production')),
140
140
  CONSTRAINT brain_substrate_states_backend_allowed
141
- CHECK (active_backend IN ('none', 'default', 'production', 'legacy_cognee')),
141
+ CHECK (active_backend IN ('none', 'default', 'production', 'legacy_graph')),
142
142
  CONSTRAINT brain_substrate_states_status_allowed
143
143
  CHECK (status IN (
144
144
  'not_installed',
@@ -383,4 +383,4 @@ CREATE INDEX IF NOT EXISTS brain_artifact_manifests_migration_idx
383
383
  CREATE INDEX IF NOT EXISTS brain_artifact_manifests_source_idx
384
384
  ON brain.artifact_manifests (tenant_id, source_family, source_id_hash);
385
385
 
386
- SELECT pg_advisory_unlock(hashtext('migration:0166_company_brain_substrate_contract'));
386
+ SELECT pg_advisory_unlock(hashtext('migration:0166_brain_substrate_contract'));
@@ -1,8 +1,8 @@
1
1
  -- Purpose: extend brain.artifact_manifests with runtime provenance needed for
2
- -- replayable Company Brain source artifacts and Knowledge Graph ingest links.
3
- -- Plan: docs/plans/2026-06-14-001-feat-company-brain-artifact-manifests-plan.md U2
2
+ -- replayable ThinkWork Brain source artifacts and Knowledge Graph ingest links.
3
+ -- Plan: docs/plans/2026-06-14-001-feat-brain-artifact-manifests-plan.md U2
4
4
  -- Apply manually (no CI migration runner):
5
- -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0167_company_brain_artifact_manifest_runtime.sql
5
+ -- psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0167_brain_artifact_manifest_runtime.sql
6
6
  -- Pre-flight:
7
7
  -- SELECT to_regclass('brain.artifact_manifests');
8
8
  -- SELECT to_regclass('public.knowledge_graph_ingest_runs');
@@ -27,7 +27,7 @@
27
27
  SET lock_timeout = '5s';
28
28
  SET statement_timeout = '15min';
29
29
 
30
- SELECT pg_advisory_lock(hashtext('migration:0167_company_brain_artifact_manifest_runtime'));
30
+ SELECT pg_advisory_lock(hashtext('migration:0167_brain_artifact_manifest_runtime'));
31
31
 
32
32
  ALTER TABLE brain.artifact_manifests
33
33
  ADD COLUMN IF NOT EXISTS ingest_run_id uuid,
@@ -82,4 +82,4 @@ CREATE INDEX IF NOT EXISTS brain_artifact_manifests_ingest_run_idx
82
82
  CREATE INDEX IF NOT EXISTS brain_artifact_manifests_source_kind_idx
83
83
  ON brain.artifact_manifests (tenant_id, source_kind, source_id_hash);
84
84
 
85
- SELECT pg_advisory_unlock(hashtext('migration:0167_company_brain_artifact_manifest_runtime'));
85
+ SELECT pg_advisory_unlock(hashtext('migration:0167_brain_artifact_manifest_runtime'));
@@ -11,7 +11,7 @@
11
11
  -- Hand-rolled (NOT registered in meta/_journal.json — the journal snapshot
12
12
  -- stopped at 0020; repo convention is psql-applied files gated by the
13
13
  -- db:migrate-manual drift reporter). Renumbered 0166 → 0168 after rebasing
14
- -- onto main, which landed 0166/0167 (company-brain); the table was already
14
+ -- onto main, which landed 0166/0167 (brain); the table was already
15
15
  -- applied to dev under the old name (rename is file-only, no DB change).
16
16
  --
17
17
  -- Semantics:
@@ -16,7 +16,7 @@ SET statement_timeout = '15min';
16
16
  DO $$
17
17
  BEGIN
18
18
  IF to_regclass('brain.artifact_manifests') IS NULL THEN
19
- RAISE EXCEPTION 'brain.artifact_manifests not found; apply Company Brain artifact manifest migrations first';
19
+ RAISE EXCEPTION 'brain.artifact_manifests not found; apply ThinkWork Brain artifact manifest migrations first';
20
20
  END IF;
21
21
  END $$;
22
22
 
@@ -0,0 +1,40 @@
1
+ -- Purpose: eval_results.execution_tier — HOW the response was produced
2
+ -- (Eval Execution Tiers v1). 'agent' = full Pi turn via
3
+ -- AgentCore (workspace, tools, MCP); 'model' = one stateless
4
+ -- Bedrock Converse call with the run's pinned composed prompt.
5
+ -- An execution detail of the row, not a lifecycle: scoring,
6
+ -- trials, and verdicts are tier-agnostic. Default 'agent' so
7
+ -- every historical row and any pre-tier writer stays honest —
8
+ -- nothing silently gets cheaper.
9
+ -- Plan: docs/plans/2026-07-02-001-feat-eval-execution-tiers-plan.md
10
+ -- Apply manually: psql "$DATABASE_URL" -v ON_ERROR_STOP=1 -f packages/database-pg/drizzle/0200_eval_results_execution_tier.sql
11
+ --
12
+ -- Hand-rolled (NOT registered in meta/_journal.json — repo convention is
13
+ -- psql-applied files gated by the db:migrate-manual drift reporter).
14
+ --
15
+ -- creates-column: public.eval_results.execution_tier
16
+ -- creates-constraint: public.eval_results.eval_results_execution_tier_check
17
+
18
+ \set ON_ERROR_STOP on
19
+
20
+ BEGIN;
21
+
22
+ SET LOCAL lock_timeout = '5s';
23
+
24
+ ALTER TABLE public.eval_results
25
+ ADD COLUMN IF NOT EXISTS execution_tier text NOT NULL DEFAULT 'agent';
26
+
27
+ DO $$
28
+ BEGIN
29
+ IF NOT EXISTS (
30
+ SELECT 1 FROM pg_constraint
31
+ WHERE conname = 'eval_results_execution_tier_check'
32
+ AND conrelid = 'public.eval_results'::regclass
33
+ ) THEN
34
+ ALTER TABLE public.eval_results
35
+ ADD CONSTRAINT eval_results_execution_tier_check
36
+ CHECK (execution_tier IN ('agent', 'model'));
37
+ END IF;
38
+ END $$;
39
+
40
+ COMMIT;