Skip to content

fix(memory): route consolidation through dreams, drop broken CRIX publisher#79

Merged
stackbilt-admin merged 17 commits into
mainfrom
auto/feature/issue-72
Jul 1, 2026
Merged

fix(memory): route consolidation through dreams, drop broken CRIX publisher#79
stackbilt-admin merged 17 commits into
mainfrom
auto/feature/issue-72

Conversation

@stackbilt-admin

Copy link
Copy Markdown
Member

Summary

  • Retargets consolidateEpisodicToSemantic to write through the wiki (dreams-scoped) instead of raw memory-worker fragments, closing the unmigrated gap flagged in aegis-oss#78.
  • Drops the dead CRIX candidate publisher.
  • Bumps package to v0.8.7 for release.

Closes aegis-oss#78.

🤖 Generated with Claude Code

Aegis and others added 17 commits June 26, 2026 04:49
Contract ExecutorRouteShapeSchema declared isDefault as a valid field
but the ExecutorRoute interface omitted it, causing TS2353 on the
workers_ai route. Aligns interface with contract.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
CF Workers AI's Ai.run() overload union is too wide for direct casts.
Wrap the call via an explicit function signature cast so TypeScript
resolves a single unambiguous overload, then cast the return to
AiChatResponse. Removes the previous as-Record<string,unknown> hack
that still leaked the intersection mismatch.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The UPDATE had no status check, allowing done/dismissed items to be
re-resolved or re-dismissed. Contract declares both as terminal with no
outgoing transitions. Add AND status='active' to the WHERE clause and
throw when 0 rows are affected (item missing or already terminal).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…, authority

48 tests derived from agenda-item.contract.ts. Covers all schema field
constraints, all operation input schemas, valid/invalid state machine
transitions (done/dismissed as terminals), the resolved_has_timestamp
invariant, and authority rules per operation.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…s, authority

53 tests derived from cc-task.contract.ts. Covers all schema constraints,
operation inputs, multi-source cancel transition (pending|running→cancelled),
proposed_task_needs_approval and completed_has_timestamp invariants, and
authority rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…authority

65 tests derived from goal.contract.ts. Covers schema constraints,
all valid transitions including multi-source (active|paused→completed/failed),
terminal state enforcement, the completed_has_timestamp invariant, and
authority rules (terminal ops and recordRun are system-only).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
4 tests filling the only gaps in executor-router-semantic.test.ts: the
negative cases for I1 (anthropic routes must have a fallback) and I2
(free-tier routes are terminal). I3–I6 violation paths were already
covered. All six invariants now have both happy and violation coverage.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
33 tests derived from memory-entry.contract.ts. Covers CRIX validation
pipeline transitions (candidate→validated→expert→canonical), refute
terminal edges, refuted_entry_not_canonical and high_confidence_for_canonical
invariants (including 0.9 boundary), terminal stage enforcement, and
authority rules.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Appends the audit telemetry entry from the OTDD baseline governance
check. Trailer coverage at 0% is the primary drag; pattern definitions
and policy docs are at full score.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- CHANGELOG.md: add Unreleased entry for OTDD test suites and three bug
  fixes (executor-router interface, workers-ai cast, agenda terminal guard)
- docs/architecture.md: add Contract Ontology section documenting all six
  .contract.ts files, their invariants, and the OTDD approach; notes #75
  for runtime enforcement wiring
- CONTRIBUTING.md: add OTDD section explaining how to write contract tests
  (schema, state machine, invariants, authority — no mocks)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…t dedup

- Remove undeclared groq → workers_ai fallback from EXECUTOR_ROUTES (dispatch
  never reads route.fallback; false resilience signal removed; wiring tracked
  in #75)
- Guard placeholder routes in dispatch default branch before EXECUTOR_FNS lookup
  so cerebras_mid/reasoning produce a clear error rather than 'Unknown executor'
- Catch resolveAgendaItem throw in handleInProcessTool's resolve_agenda_item
  branch so an already-resolved item returns an error string to the model
  instead of killing the tool-call loop
- Isolate resolveAgendaItem in agenda-triage into its own try/catch so a DB
  failure after a successful createIssue doesn't leave the item active and
  trigger duplicate issue creation on the next cycle
- Add two missing tests for resolveAgendaItem: AND status='active' SQL guard
  and throw-on-changes=0 coverage
- Extract duplicated Ai.run() overload cast into callAiRun() helper

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
agenda-triage: inner catch now attempts dismiss as a fallback sentinel
when resolveAgendaItem('done') fails after a successful createIssue,
preventing the item from staying active and generating a duplicate
GitHub issue on the next cron cycle.

dispatch: hoist placeholder guard before the switch so any future named
case for a placeholder executor cannot silently bypass the check.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Replace the monolithic daily email with a focused co-founder brief:
- Add lead signal banner (single highest-priority item: critical alerts,
  payment failures, high alerts, fail rate, deadlines, revenue)
- Drop: Cognitive Scorecard, Operator's Log, ARGUS Events, Developer
  Activity, Memory Reflection, canned Co-Founder's Take
- Filter service alerts to high/critical only (remove medium telemetry)
- Filter health checks to high/critical only
- Strip auto-generated analytics commentary (data tables stay)
- Awaiting Action: collapse skill-evolution proposals to one row,
  cap other proposed tasks at 3, cap agenda items at 3, move
  sentinel alarms to a dimmed "Chronic" footnote
- Reorder: Lead → Work Shipped → Alerts → Health → Traffic → Actions
- Bump version to 0.8.5

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ion (v0.8.6)

@stackbilt/wasm-core calls wasm.__wbindgen_start() at module init time.
CF Workers validation runs before WASM instantiation, so the call fails
with 'wasm.__wbindgen_start is not a function'. Moved WasmGraph import
inside getWasmGraph() so the wasm-bindgen init defers until activateGraph()
is actually called under the live CF runtime.

aegis-core@0.8.5 was never deployable; 0.8.6 supersedes it.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…lisher (aegis-oss#78, v0.8.7)

consolidateEpisodicToSemantic wrote raw fragments straight into the
memory-worker store, bypassing the wiki SoT the #457 unification
established - the original decision doc explicitly deferred this as
needing design work, which never happened until now. It now writes
through writeDreamFact() into scope:dreams pages, matching the pattern
the daemon's synthesis.ts (PRISM) already proves in production. Dropped
the ADD/UPDATE/DELETE-by-fragment-id model in favor of pure additive
writes - dream pages don't support patch-by-id, and the dreams lifecycle
(promote on corroboration, archive if stale) is the intended mechanism
for handling staleness under the unified model.

Also removed publishInsightsFromMemory() from the consolidation scheduled
task: it called publishInsight()/validateInsight() against a D1 table
named `memory` that no migration in this repo (or aegis-daemon) ever
creates. Every invocation was silently failing every cycle, caught and
logged as a warning. insights.ts's public API is untouched - only this
broken internal call site is gone.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@stackbilt-admin stackbilt-admin merged commit 7936270 into main Jul 1, 2026
2 checks passed
@stackbilt-admin stackbilt-admin deleted the auto/feature/issue-72 branch July 1, 2026 09:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant