legion-gaia 0.9.66 → 0.10.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 (48) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +33 -0
  3. data/Gemfile +1 -1
  4. data/README.md +156 -54
  5. data/legion-gaia.gemspec +1 -1
  6. data/lib/legion/gaia/advisory.rb +116 -65
  7. data/lib/legion/gaia/anticipation.rb +276 -0
  8. data/lib/legion/gaia/audit_observer.rb +25 -22
  9. data/lib/legion/gaia/behavioral_synapse.rb +105 -93
  10. data/lib/legion/gaia/bond_persistence.rb +115 -0
  11. data/lib/legion/gaia/bond_registry.rb +129 -270
  12. data/lib/legion/gaia/bond_tracker.rb +5 -44
  13. data/lib/legion/gaia/calibration_tracker.rb +122 -0
  14. data/lib/legion/gaia/channel_registry.rb +12 -0
  15. data/lib/legion/gaia/channels/cli_adapter.rb +5 -2
  16. data/lib/legion/gaia/channels/slack_adapter.rb +17 -6
  17. data/lib/legion/gaia/channels/teams/bot_framework_auth.rb +2 -1
  18. data/lib/legion/gaia/channels/teams/conversation_store.rb +45 -26
  19. data/lib/legion/gaia/channels/teams/webhook_handler.rb +5 -6
  20. data/lib/legion/gaia/channels/teams_adapter.rb +17 -11
  21. data/lib/legion/gaia/death_protocol.rb +67 -116
  22. data/lib/legion/gaia/disclosure.rb +33 -28
  23. data/lib/legion/gaia/gut.rb +293 -0
  24. data/lib/legion/gaia/input_frame.rb +31 -1
  25. data/lib/legion/gaia/notification_gate/delay_queue.rb +10 -0
  26. data/lib/legion/gaia/notification_gate.rb +10 -2
  27. data/lib/legion/gaia/output_router.rb +12 -1
  28. data/lib/legion/gaia/partner_model.rb +186 -52
  29. data/lib/legion/gaia/phase_wiring.rb +543 -169
  30. data/lib/legion/gaia/registry.rb +280 -35
  31. data/lib/legion/gaia/response_attribution/journal.rb +110 -0
  32. data/lib/legion/gaia/response_attribution/receipts.rb +158 -0
  33. data/lib/legion/gaia/response_attribution.rb +185 -0
  34. data/lib/legion/gaia/router/agent_bridge.rb +6 -2
  35. data/lib/legion/gaia/router/router_bridge.rb +10 -6
  36. data/lib/legion/gaia/router/transport/messages/input_frame_message.rb +3 -1
  37. data/lib/legion/gaia/routes.rb +57 -7
  38. data/lib/legion/gaia/runner_host.rb +22 -1
  39. data/lib/legion/gaia/sensory_buffer.rb +23 -0
  40. data/lib/legion/gaia/session_store.rb +13 -42
  41. data/lib/legion/gaia/settings.rb +18 -1
  42. data/lib/legion/gaia/tick_history.rb +45 -14
  43. data/lib/legion/gaia/tracker_persistence.rb +143 -73
  44. data/lib/legion/gaia/version.rb +1 -1
  45. data/lib/legion/gaia/visible_growth.rb +30 -29
  46. data/lib/legion/gaia.rb +546 -495
  47. metadata +10 -4
  48. data/lib/legion/gaia/bond_store.rb +0 -299
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dc0229532bc53d2868fac7cc6279bb2875ceaaedbb63269dc8b5a742a7c95832
4
- data.tar.gz: da7e11d18691d6af5e90e2c4da209feaf1b6ab79b4aaa91f4c409e517d7428cf
3
+ metadata.gz: 48f3c59dd119b1a9a314313c5440d2003e65747dafbfe25e743cff50a4e4e511
4
+ data.tar.gz: 676df1567bda9c7011f39d3a409396eb1414d2938e07a14d6eb656c5d71521e8
5
5
  SHA512:
6
- metadata.gz: c87775e2f41b815da9b996ceca3383dbf956ec8c8e643c26ec8390fb7477fc0ead9739b4802cbdc5984ebf1266f1d5dd22d145c7b657cc8e7712035f0496932c
7
- data.tar.gz: e03a41455d7d36dbb49d89e2b7c74e3db930c07a1a730cb4c695a088c446be020463ff0ea588bdea1ce01b06504890890afa08c42344fbd16e71b6818058727b
6
+ metadata.gz: 6ec28771fc7715ad86327681f6132bc3063c963e18f96611a969a463e7291be54f49a5c9f2a3d22de62338486af9a273749bddebee75fc81a2fc60ef90ac39a3
7
+ data.tar.gz: d7107fc5c623d251c89cfdcdd42589ee0a79ad8f5e665a473a55363bf90cc9f36c2173237a6dddc433da619266370b4126bcab7f1a79c8db5310211552e10294
data/CHANGELOG.md CHANGED
@@ -1,5 +1,38 @@
1
1
  # Changelog
2
2
 
3
+ ## [0.10.0] - 2026-10-30
4
+
5
+ ### Added
6
+ - Identity/conversation-scoped cognitive hosts, tick history, advisory provenance, delivered-response receipts, and explicit human-observed prediction/intention outcomes.
7
+ - Durable response claims, correction evidence, consent barriers, and resumable termination through Apollo Local. Interrupted feedback remains uncertain rather than being graded twice.
8
+ - Explicit `gaia.tick.enabled_optional_phases` opt-ins for `global_workspace` and `metacognition` with supporting `lex-tick`; both remain disabled by default.
9
+ - Per-capability demonstrated readiness and last meaningful outcomes, including measured cognitive health and introspection assessments.
10
+
11
+ ### Fixed
12
+ - Select bounded, relevant, authorized dream memories; unwrap ranked traces correctly and verify actual Hebbian associations.
13
+ - Store supported episodic corrections and preserve their constraints/source references. Explicit corrections affect PartnerModel and Gut even when scoped calibration is unavailable.
14
+ - Keep trusted principal IDs, native channel ownership, session continuity, feedback, growth, and delayed delivery isolated across humans and conversations.
15
+ - Persist the actual live bond, behavioral, and scoped calibration stores; acknowledge dirty revisions only after successful writes.
16
+ - Complete scoped session/attribution erasure against the real runtime, preserve lifecycle barriers across restart, and remove owned local snapshots and FTS/source-link rows.
17
+ - Preserve failure, partial, deferred, missing-handler, and budget-skipped phase meaning. A loaded extension, empty competition, or proposed intention is not completed work.
18
+ - Consume attended inputs and workspace-selected memories in prediction/executive decisions; resolve only explicitly correlated human-observed outcomes.
19
+ - Defer shutdown finalization when a heartbeat exceeds its wait timeout instead of deadlocking or clearing state underneath active work.
20
+
21
+ ### Changed
22
+ - Require published `legion-apollo >= 0.5.13` for correct changed-content FTS snapshot updates.
23
+ - Pipeline notifications no longer count as a second human observation. Uncorrelated or unapplied response suggestions remain ungraded.
24
+ - Human history/disclosure/termination routes require the authenticated owner; Teams webhooks reject missing application authentication.
25
+ - Remove disconnected BondStore state and obsolete nil-ID phase mappings. Background maintenance and request/event-owned work are not implicitly scheduled.
26
+ - Existing pre-0.10 readers do not enforce the new privacy barriers: quiesce and forward-fix rather than rolling back to an unsafe reader.
27
+
28
+ ## [0.9.67] - 2026-07-24
29
+ ### Added
30
+ - H5: `Legion::Gaia::Gut.check(identity:, draft_stats:)` — fast per-response conflict detection (v1: correction veto only). Compares draft stats against high-strength correction traces and transform-tier behavioral synapses. No LLM calls. Completes within 50ms latency budget (scalar setting); degrades to no-op if exceeded. Soft-guarded on lex-agentic-memory. The gut itself is a behavioral synapse (`domain: 'gut'`); new partners start in observe mode (emergent confidence 0.3 → observe tier).
31
+ - H6: `Legion::Gaia::Anticipation.build(identity:, context:)` — builds anticipation context from actionable pending predictions (confidence >= threshold). Pre-stages RAG entries capped at 25% of total. Soft-guarded on lex-agentic-inference.
32
+ - H6: `Legion::Gaia::Anticipation.resolve(identity:, prediction_id:, actual:)` — grades a pending prediction as `:correct`, `:incorrect`, or `:partial` against the partner's actual input. Entropy guard: no resolution under high identity entropy.
33
+ - H6: `Legion::Gaia::Anticipation.deferred?(identity:, anticipation:)` — §12.8 emotional modulation: negative-valence anticipations defer when partner affect baseline is low. Soft-guarded on lex-agentic-affect.
34
+ - Settings defaults: `gut.latency_budget_ms` (50ms), `gut.correction_min_strength` (0.6), `gut.correction_trace_limit` (20), `anticipation.actionable_threshold` (0.65)
35
+
3
36
  ## [0.9.66] - 2026-07-24
4
37
  ### Added
5
38
  - `Gaia.observe_from_pipeline(identity:, caller:, exchange_id:)` — pipeline observation for API clients; reinforces bond, triggers coldstart, registers duckling partner on first human request
data/Gemfile CHANGED
@@ -4,7 +4,7 @@ source 'https://rubygems.org'
4
4
 
5
5
  gemspec
6
6
 
7
- gem 'legion-apollo', path: '../legion-apollo' if File.exist?(File.expand_path('../legion-apollo', __dir__))
7
+ gem 'legion-apollo', path: '../legion-apollo' if File.directory?(File.expand_path('../legion-apollo', __dir__))
8
8
 
9
9
  gem 'rake'
10
10
  gem 'rspec'
data/README.md CHANGED
@@ -25,8 +25,8 @@ job engine runs without it, and none of its cognitive mechanics activate unless
25
25
  ├──────────────────────┤ ├────────────────────────────┤ ├──────────────────────┤
26
26
  │ CLI │ │ SensoryBuffer │ │ ChannelAwareRenderer │
27
27
  │ Microsoft Teams │ ──▶ │ Heartbeat → lex-tick │ ──▶ │ NotificationGate │
28
- │ Slack │ │ 37 cognitive phases │ │ OutputRouter │
29
- │ HTTP /api/gaia/ingest│ │ (16 active · 21 dream) │ │ ChannelAdapter#deliver│
28
+ │ Slack │ │ Scoped phase handlers │ │ OutputRouter │
29
+ │ HTTP /api/gaia/ingest│ │ Explicit optional groups │ │ ChannelAdapter#deliver│
30
30
  └──────────────────────┘ └────────────────────────────┘ └──────────────────────┘
31
31
  translate inbound ───▶ ingest · tick · think · decide ───▶ gate · render · deliver
32
32
  ```
@@ -37,12 +37,12 @@ job engine runs without it, and none of its cognitive mechanics activate unless
37
37
 
38
38
  ### Highlights
39
39
 
40
- - 🧠 **Continuous cognition.** A 1-second heartbeat drains the sensory buffer and runs a full tick through `lex-tick`, so the agent is always thinking — not just request/response.
41
- - 🔌 **Channel abstraction.** CLI, Microsoft Teams, and Slack share one `ChannelAdapter` contract; the cognitive core never knows which interface it is talking to.
42
- - 🌙 **Active *and* dream cycles.** 16 active-tick phases (sensory → emotion → memory → action) plus 21 dream-cycle phases (memory audit, association walk, creativity, metacognition, global workspace) run through one weighted pipeline.
43
- - 🛡️ **Notification gating.** Outbound frames pass schedule (quiet hours) → presence (Teams status) → behavioral (arousal/idle) evaluators before delivery; urgent priority bypasses the gate.
44
- - 🛰️ **Hub-and-spoke router mode.** Keep channel-facing ingress on a public router while private agents do the cognitive work, relayed over Legion transport with worker allowlists.
45
- - 🕊️ **Graceful quiescence.** Shutdown blocks new heartbeats, drains in-flight work, and skips phase handlers cleanly so late tick work never writes into closed services.
40
+ - **Bounded cognition.** A heartbeat drains one identity/conversation at a time under the existing tick budget.
41
+ - **Channel abstraction.** CLI, Microsoft Teams, and Slack share a channel contract while retaining exact authenticated owners and destinations.
42
+ - **Explicit activation.** Default active/dream schedules remain unchanged; workspace and metacognition require opt-in and supporting providers.
43
+ - **Notification gating.** Quiet hours, presence, and behavioral gates precede delivery. Priority never bypasses a consent or termination barrier.
44
+ - **Hub-and-spoke router mode.** Public ingress can relay to private agents through existing Legion transport and worker allowlists.
45
+ - **Graceful quiescence.** New work stops before teardown; an over-time heartbeat defers finalization instead of losing its live state.
46
46
 
47
47
  ## What GAIA Does
48
48
 
@@ -78,7 +78,7 @@ Channel input
78
78
  The registry resolves runners from the loaded LegionIO extension set and builds phase handlers. Each
79
79
  phase handler annotates its result with:
80
80
 
81
- - `status`: `completed`, `skipped`, or `failed`
81
+ - `status`: truthful `completed`, `skipped`, `failed`, `partial`, `deferred`, or `unavailable`; history also exposes missing handlers and budget skips
82
82
  - `elapsed_ms`: monotonic elapsed time in milliseconds
83
83
 
84
84
  Those fields feed `/api/gaia/ticks` for operator-facing tick-stream observability — every event
@@ -86,9 +86,9 @@ should have a non-null `status` and `elapsed_ms`.
86
86
 
87
87
  ## The Mechanics, From Source
88
88
 
89
- GAIA itself does not implement learning — it schedules and wires the extensions that do. The
90
- formulas below live in the sibling gems GAIA coordinates, and are cited here so the claims can be
91
- checked against source rather than taken on faith.
89
+ GAIA coordinates extension learning and owns scoped relationship/response attribution. The
90
+ formulas below describe specific mechanisms, not evidence that a proposed action succeeded.
91
+ Confidence and bond strength never grant permission.
92
92
 
93
93
  **Connection reinforcement — [`lex-synapse`](https://github.com/LegionIO/lex-synapse):**
94
94
 
@@ -118,10 +118,11 @@ have different confidence constants. Do not conflate them.
118
118
 
119
119
  **Tick scheduling — `lex-tick` constants:**
120
120
 
121
- - 16 full-active phases, 10 dream phases.
122
- - 4 modes with fixed time budgets: `dormant` 0.2s, `sentinel` 0.5s, `full` and `dream` 5.0s each.
123
- - Tick history is an **in-memory, 200-entry ring buffer** recording `{ timestamp, phase, duration_ms,
124
- status }` per phase. This is not database-persisted — restart the process and it is gone.
121
+ - Default schedules: 16 full-active phases and 10 dream phases (identity entropy is shared).
122
+ - Four modes and existing budgets: `dormant` 0.2s, `sentinel` 0.5s, `full_active` and `dormant_active` 5.0s.
123
+ - The budget is checked between handlers; a blocking handler is not preempted. Optional work receives no extra budget.
124
+ - Tick history is an in-memory, 200-entry ring buffer with identity/conversation/exchange ownership.
125
+ It records scheduled, missing, deferred, failed, and budget-skipped work; it does not survive restart.
125
126
 
126
127
  ## Measured, From the Maintainer's Development Instance
127
128
 
@@ -176,6 +177,24 @@ domain gems and operational extensions such as `lex-mesh`, `lex-synapse`, `lex-d
176
177
  `lex-coldstart`. Channel-specific delivery depends on the matching extension (for example
177
178
  `lex-microsoft_teams` or `lex-slack`).
178
179
 
180
+ ### Provider compatibility and activation
181
+
182
+ | Provider | Supported behavior |
183
+ |----------|--------------------|
184
+ | `legion-apollo >= 0.5.13` | Required. Earlier changed-content FTS updates can break durable GAIA snapshots. |
185
+ | `lex-agentic-memory 0.1.41` | Verified existing audit, association, episodic correction, and Gut consumption APIs; no new memory release is required for these handoffs. |
186
+ | `lex-tick 0.1.17` | Default schedules remain usable; optional groups report unsupported. |
187
+ | `lex-tick >= 0.1.18` | Explicit `global_workspace` / `metacognition` scheduling. Capability detection requires the actual keyword contract, not a catch-all `**kwargs`. |
188
+ | `lex-agentic-social 0.1.21` | Explicit corrections remain effective; scoped calibration is unavailable and never falls back to shared/latest-response state. |
189
+ | `lex-agentic-social >= 0.2.0` | Scoped calibration receipts, weights, and restoration when the explicit identity APIs are available. |
190
+ | `lex-agentic-inference 0.1.11` | Existing identity-aware generation/resolution APIs support verifiable predictions; no newer inference release is required. Providers missing those contracts remain unavailable. |
191
+
192
+ New tick/social versions are optional capability prerequisites, not permission to deploy unpublished
193
+ branches. Leave their capabilities unavailable until their independent releases are installed.
194
+ Published-provider and candidate-package combinations are exercised separately.
195
+ Existing LLM callers that do not return applied source IDs remain ungraded; GAIA does not fabricate
196
+ delivery acknowledgments or require a coordinated LLM upgrade.
197
+
179
198
  ## Basic Usage
180
199
 
181
200
  ```ruby
@@ -201,13 +220,17 @@ Legion::Gaia.shutdown
201
220
  | Method | Description |
202
221
  |--------|-------------|
203
222
  | `Legion::Gaia.boot(mode: nil)` | Boot the runtime. `mode: :router` boots channels only (hub-and-spoke router). |
204
- | `Legion::Gaia.ingest(input_frame)` | Push an `InputFrame` into the sensory buffer. Returns `{ ingested:, buffer_depth:, session_id: }`. |
205
- | `Legion::Gaia.heartbeat` | Drain the buffer and execute one cognitive tick. Returns the tick result hash. |
206
- | `Legion::Gaia.respond(content:, channel_id:, ...)` | Build an `OutputFrame` and route it through the output pipeline. |
207
- | `Legion::Gaia.status` | Runtime + UI state for status/observability tooling. |
208
- | `Legion::Gaia.tick_history` | Ring buffer of recent phase events. |
209
- | `Legion::Gaia.shutdown` | Quiesce and tear down the runtime. |
223
+ | `Legion::Gaia.ingest(input_frame)` | Accept trusted input; return `{ ingested:, buffer_depth:, session_id:, exchange_id: }` and any explicit `cognitive_outcome`. Rejections include a reason. |
224
+ | `Legion::Gaia.heartbeat` | Drain one scoped batch and execute one budgeted tick. Includes `phases_scheduled`, results, and correlation. |
225
+ | `Legion::Gaia.respond(content:, channel_id:, ...)` | Preserve the original input owner/destination when replying; apply lifecycle and delivery gates. |
226
+ | `Legion::Gaia.status(identity: nil)` | Runtime state, persistence readiness, and scoped demonstrated capabilities. |
227
+ | `Legion::Gaia.tick_history.recent(identity:, conversation_id:, limit:)` | Read owner-scoped phase history. Unscoped internal access is administrative, not a human endpoint. |
228
+ | `Legion::Gaia.shutdown` | Quiesce; return `{ stopped: false, quiescing: true }` if an active heartbeat must finish before finalization. |
210
229
  | `Legion::Gaia.started?` / `shutting_down?` | Lifecycle predicates. |
230
+ | `Legion::Gaia::Advisory.advise(caller:, conversation_id:, exchange_id:)` | Return proposed adjustments with an advisory ID and selected-source provenance, without claiming application. |
231
+ | `Legion::Gaia.record_response_applied(advisory_id:, identity:, applied:)` | Persist a returned/sent/acknowledged receipt for explicitly selected source IDs. |
232
+ | `Legion::Gaia::Disclosure.report(identity:)` | Describe the same live/restored state used by behavior and the actual privacy/deletion boundaries. |
233
+ | `Legion::Gaia::DeathProtocol.terminate_bond(identity:, confirm: true)` | Persist the barrier before erasure and return per-store acknowledgments; partial failure remains blocked and retryable. |
211
234
 
212
235
  ## Configuration
213
236
 
@@ -222,6 +245,8 @@ gaia:
222
245
  shutdown:
223
246
  heartbeat_wait_timeout: 30.0
224
247
  heartbeat_wait_log_interval: 5.0
248
+ tick:
249
+ enabled_optional_phases: [] # opt in one verified group at a time
225
250
  channels:
226
251
  cli:
227
252
  enabled: true
@@ -258,7 +283,6 @@ gaia:
258
283
  retrieval_min_confidence: 0.3
259
284
  memory_retrieval_limit: 10
260
285
  memory_audit_limit: 20
261
- memory_skip_threshold: 0.8
262
286
  ```
263
287
 
264
288
  `connected` is managed by GAIA at boot and shutdown. Set `router.mode` to `true` on private agent
@@ -267,23 +291,89 @@ processes that should publish through a central router; boot the public router w
267
291
 
268
292
  ## Cognitive Phases
269
293
 
270
- GAIA wires two phase groups through `PhaseWiring::PHASE_MAP` — 37 phases in total (16 active-tick,
271
- 21 dream-cycle). Each entry maps a phase name to an extension runner and method; phases whose runner
272
- extension is not loaded are skipped, and the rest are wired into the tick pipeline.
294
+ The default full-active schedule has 16 phases; the dream schedule has 10, including the shared
295
+ identity-entropy phase. Discovery does not activate extra work. Missing handlers remain visible.
296
+
297
+ **Full active:** sensory processing, emotional evaluation, memory retrieval, knowledge retrieval,
298
+ identity entropy, working memory integration, procedural check, prediction, mesh interface, social
299
+ cognition, theory of mind, gut instinct, action selection, memory consolidation, homeostasis,
300
+ and post-tick reflection.
301
+
302
+ **Dream:** memory audit, association walk, contradiction resolution, identity entropy, agenda
303
+ formation, consolidation commit, knowledge promotion, dream reflection, partner reflection,
304
+ and dream narration.
305
+
306
+ **Optional full-active groups:**
307
+
308
+ | Group | Placement and prerequisite | Observable consumer |
309
+ |-------|----------------------------|---------------------|
310
+ | `global_workspace` | After gut instinct; requires meaningful sensory processing and correlated candidates | The selected signal/memory changes executive drives and intention formation. |
311
+ | `metacognition` | After meaningful post-tick reflection | Current demonstrated assessments update scoped capability readiness/history; loaded constants are only inventory. |
312
+
313
+ Opt in with `gaia.tick.enabled_optional_phases: [global_workspace]` or `[metacognition]`.
314
+ Both default to off. Failed prerequisites defer the group; unavailable providers do not produce
315
+ success-shaped placeholders. `status(identity:)[:capabilities]` reports readiness, ownership,
316
+ the latest observed status/reason, and the last meaningful outcome/time. A later budget skip
317
+ does not erase earlier evidence or continue claiming current readiness.
273
318
 
274
- **Active tick (16):** sensory processing, emotional evaluation, memory retrieval, knowledge
275
- retrieval, identity entropy check, working memory integration, procedural check, prediction engine,
276
- mesh interface, social cognition, theory of mind, gut instinct, action selection, memory
277
- consolidation, homeostasis regulation, and post-tick reflection.
319
+ Other former extra mappings retain their actual owners:
278
320
 
279
- **Dream cycle (21):** memory audit, association walk, contradiction resolution, agenda formation,
280
- curiosity execution, consolidation commit, knowledge promotion, dream reflection, partner
281
- reflection, dream narration, dream cycle, creativity tick, lucid dream, epistemic vigilance,
282
- predictive processing, free energy, metacognition, default mode network, prospective memory, inner
283
- speech, and global workspace.
321
+ | Work | Owner |
322
+ |------|-------|
323
+ | Curiosity execution, dream-cycle orchestration, creativity tick, default-mode thought | Existing background actors |
324
+ | Lucid dream, epistemic vigilance, inner speech | Explicit requests with real content and consumers |
325
+ | Predictive processing, free energy, prospective memory | Existing events with real observations, beliefs, or intentions |
284
326
 
285
- Phase handlers may skip expensive work when idle or while GAIA is shutting down. Skipped phases still
286
- produce `status` and timing metadata so the tick stream stays complete.
327
+ Memory decay and tier migration remain background-owned; their heartbeat placeholders report
328
+ `deferred` and do not duplicate maintenance. Prediction/intention creation is a proposal, not
329
+ task completion. Technical task completion and human sentiment are not objective outcome evidence.
330
+
331
+ ### Explicit outcome reports
332
+
333
+ A trusted human `InputFrame` may carry `metadata[:prediction_request]` with a nonblank `domain`,
334
+ `description`, and scalar `expected_outcome`. Later authenticated input can report:
335
+
336
+ ```ruby
337
+ cognitive_outcome: {
338
+ prediction_id: prediction_id, # or intention_id, never both
339
+ source_exchange_id: original_exchange_id,
340
+ outcome: :incorrect, # prediction: correct/incorrect/partial; intention: completed
341
+ actual: false,
342
+ confirmation: 'human_observed'
343
+ }
344
+ ```
345
+
346
+ GAIA derives the owner from the authenticated frame, checks the generated ID and original exchange,
347
+ and labels the evidence `human_confirmation`. A contradictory classification is rejected.
348
+ Heuristic predictions, missing IDs, mismatched people/exchanges, and duplicate reports cannot
349
+ resolve or reinforce another prediction/intention. No machine execution proof is invented.
350
+
351
+ ## Identity, Feedback, and Recovery
352
+
353
+ - Trusted principal IDs take precedence. Native Teams IDs include tenant ownership; Slack IDs
354
+ include workspace ownership. Display names and continuity tokens are not identity evidence.
355
+ - Input ingestion owns the human observation. Pipeline notifications do not reinforce it again.
356
+ - Advice is only a proposal. A delivery receipt must name selected behavioral/trace/adjustment
357
+ IDs and a `returned`, `sent`, or `acknowledged` delivery outcome before feedback can grade it.
358
+ - Feedback must agree with all supplied identity, conversation, response-exchange, advisory, and
359
+ reply references. There is no global/latest-response fallback.
360
+ - Explicit corrected constraints outrank inferred preferences in the matching scope. Generic
361
+ rejection vetoes the rejected sources; it neither invents a preference nor crystallizes the
362
+ rejected directive.
363
+ - Private snapshots use exact identity tags and are stored through Apollo Local. Lifecycle barriers
364
+ and response claims/acknowledgments are synchronous. Ordinary bond/behavior changes can lose up
365
+ to the existing 300-second flush interval on abrupt process loss; graceful shutdown flushes them.
366
+ - A persisted but interrupted feedback claim remains uncertain and is not automatically replayed.
367
+ Durable explicit correction evidence still constrains future behavior.
368
+ - Missing/unreadable lifecycle storage fails closed for private identities. Anonymous/core operation
369
+ stays available. Recovery retries are bounded; no shared-store fallback is used.
370
+ - Termination removes acknowledged owned snapshots, FTS/source links, live memories where supported,
371
+ sessions, pending outputs, and attribution. Its minimal barrier survives restart; partial erasure
372
+ is retried. Disclosure distinguishes local storage from deployment-dependent external processing.
373
+
374
+ Before adoption, quiesce writers and retain the previous resolved configuration. Older GAIA
375
+ versions do not honor these lifecycle barriers: rollback to them is unsafe. Disable affected optional
376
+ capabilities and forward-fix; never restore a stale snapshot over a correction or revocation.
287
377
 
288
378
  ## HTTP API
289
379
 
@@ -293,13 +383,15 @@ GAIA registers routes with [`Legion::API`](https://github.com/LegionIO/LegionIO)
293
383
 
294
384
  | Method | Path | Description |
295
385
  |--------|------|-------------|
296
- | `GET` | `/api/gaia/status` | Runtime + UI state (mode, buffer depth, channels, sessions, tick count, notification gate). |
297
- | `GET` | `/api/gaia/ticks?limit=50` | Recent phase events; `limit` is clamped to the tick-history ring-buffer size. |
386
+ | `GET` | `/api/gaia/status` | Runtime/persistence state and the authenticated owner's demonstrated capabilities. |
387
+ | `GET` | `/api/gaia/ticks?limit=50` | Requires authentication; returns only that owner's phase history. |
298
388
  | `GET` | `/api/gaia/channels` | Active channel adapters and their capabilities. |
299
389
  | `GET` | `/api/gaia/buffer` | Sensory buffer depth, emptiness, and max size. |
300
390
  | `GET` | `/api/gaia/sessions` | Active session count. |
301
- | `POST` | `/api/gaia/ingest` | Push a normalized content payload into the sensory buffer without a channel adapter. |
302
- | `POST` | `/api/channels/teams/webhook` | Microsoft Teams Bot Framework activity intake (auth-gated when `app_id` is set). |
391
+ | `POST` | `/api/gaia/ingest` | Normalize input using trusted request auth, not a body-supplied identity; rejected input returns `409`. |
392
+ | `POST` | `/api/channels/teams/webhook` | Requires configured application authentication and a verified Bot Framework bearer token. |
393
+ | `GET` | `/api/gaia/partner/:identity/report` | Authenticated-owner disclosure only. |
394
+ | `DELETE` | `/api/gaia/bond/:identity` | Authenticated-owner termination with explicit confirmation. |
303
395
 
304
396
  ### `GET /api/gaia/status`
305
397
 
@@ -327,9 +419,9 @@ delivery-likelihood score.
327
419
 
328
420
  Accepts Microsoft Teams Bot Framework activities. The route delegates to
329
421
  `Legion::Gaia::Channels::Teams::WebhookHandler`, then ingests translated message activities through
330
- `Legion::Gaia.ingest`. When a Teams `app_id` is configured, requests must carry a bearer token; GAIA
422
+ `Legion::Gaia.ingest`. A configured Teams `app_id` and bearer token are required; GAIA
331
423
  validates JWT claims and verifies the signature against Bot Framework signing keys before translating
332
- or ingesting. Missing or invalid authorization returns `401`.
424
+ or ingesting. Missing configuration or invalid authorization returns `401`.
333
425
 
334
426
  Non-message activities are intentionally acknowledged without entering cognition:
335
427
 
@@ -345,11 +437,13 @@ Non-message activities are intentionally acknowledged without entering cognition
345
437
  | Adapter | Purpose | Notes |
346
438
  |---------|---------|-------|
347
439
  | CLI | Local text interaction | Built in, enabled by default. |
348
- | Teams | Bot Framework activity ingestion and proactive delivery | Validates bearer tokens when `app_id` is set. |
440
+ | Teams | Bot Framework activity ingestion and proactive delivery | Requires application authentication; preserves exact tenant/user/conversation ownership. |
349
441
  | Slack | Slack-style rich text and threaded delivery | HMAC-SHA256 signing verification. |
350
442
 
351
- Adapters translate format and delivery semantics only. Cognitive interpretation happens downstream in
352
- the tick pipeline, so adapters stay thin, stateless, and recreatable without loss.
443
+ Adapters translate format and delivery semantics. Teams delivery requires the intended tenant and
444
+ conversation; proactive lookup matches the target user instead of borrowing another conversation in
445
+ the tenant. An explicit Slack destination cannot fall back to a default webhook. Received timestamps,
446
+ owners, destinations, and correlation survive router serialization.
353
447
 
354
448
  ## Notification Gate
355
449
 
@@ -359,8 +453,9 @@ The notification gate evaluates outbound frames before delivery, in order:
359
453
  2. `PresenceEvaluator` — maps Teams presence to a minimum delivery priority.
360
454
  3. `BehavioralEvaluator` — scores arousal and idle signals into a delivery-likelihood value.
361
455
 
362
- Urgent or critical frames bypass quiet-hour delays through `priority_override`. Delayed frames are
363
- stored in a bounded `DelayQueue` and re-evaluated each heartbeat.
456
+ Urgent or critical frames bypass quiet-hour delays through `priority_override`, but never bypass
457
+ revocation/termination. Delayed frames remain scoped and bounded; lifecycle is checked again at
458
+ final delivery and terminated identities' queued frames are removed.
364
459
 
365
460
  ## Router Mode
366
461
 
@@ -395,10 +490,11 @@ Channel client -> GAIA router -> Legion transport -> GAIA agent
395
490
  4. Trackers and channel/router bridges are flushed or stopped.
396
491
  5. Runtime references are cleared.
397
492
 
398
- `shutdown.heartbeat_wait_timeout` bounds how long shutdown waits for in-flight heartbeat work before
399
- logging a warning and continuing; `shutdown.heartbeat_wait_log_interval` controls wait-progress logs.
400
- This keeps routine shutdown from producing late writes to closed data/logging resources while
401
- avoiding an indefinite hang if a heartbeat blocks inside extension work.
493
+ `shutdown.heartbeat_wait_timeout` bounds the caller's wait. If a heartbeat is still running, shutdown
494
+ returns `quiescing: true`, leaves its resources intact, and rejects reboot/new work. The last active
495
+ heartbeat performs final teardown after leaving the shared write lock.
496
+ `shutdown.heartbeat_wait_log_interval` controls wait-progress logs. Operators must not close shared
497
+ data/logging services while GAIA still reports quiescing.
402
498
 
403
499
  ## Integration with LegionIO
404
500
 
@@ -417,10 +513,16 @@ Sibling gems referenced above:
417
513
 
418
514
  ```bash
419
515
  bundle install
420
- bundle exec rspec # 0 failures required before commit
421
- bundle exec rubocop # 0 offenses required
516
+ bundle exec rubocop -A
517
+ bundle exec rspec --format json --out tmp/rspec_results.json --format progress --out tmp/rspec_progress.txt
422
518
  ```
423
519
 
520
+ Require a clean whole-repo lint pass and full-suite exit status after the last Ruby edit. Keep RSpec
521
+ stdout quiet; inspect only extracted failed examples when it fails. Package acceptance must use
522
+ installed gem artifacts, not sibling path overrides. Release scenarios cover real memory/association,
523
+ correction-to-next-context, two-human/conversation isolation, interrupted feedback claims, SQLite/FTS
524
+ termination, and independently opted-in workspace/metacognition with supporting provider artifacts.
525
+
424
526
  The build artifact (`*.gem`) is not the source of truth; release tooling builds it from the version
425
527
  in `lib/legion/gaia/version.rb`.
426
528
 
data/legion-gaia.gemspec CHANGED
@@ -40,7 +40,7 @@ Gem::Specification.new do |spec|
40
40
  spec.add_dependency 'lex-privatecore'
41
41
 
42
42
  # PHASE_MAP operational extensions (required for full tick cycle)
43
- spec.add_dependency 'legion-apollo', '>= 0.2.1'
43
+ spec.add_dependency 'legion-apollo', '>= 0.5.13'
44
44
  spec.add_dependency 'lex-apollo'
45
45
  spec.add_dependency 'lex-coldstart'
46
46
  spec.add_dependency 'lex-detect'