Cambium Remediation Plan
Date: 2026-03-22
Purpose
This document translates the reality check into concrete work.
The goal is not to add aspirational scope. The goal is to make Cambium’s existing claims literally true, close the highest-risk gaps, and give the project a credible path from demo-ready to production-ready.
Guiding Principle
Prioritize truth over surface area.
That means:
- Fix broken repo guarantees before adding new subsystem breadth
- Finish durability before adding more memory-only behavior
- Enforce architectural rules instead of merely documenting them
- Tighten operational seams in Loom before expanding the UI
Remediation Goals
- Restore clean repo verification.
- Complete the durable-state story for critical subsystem data.
- Eliminate hardcoded or implicit workspace scoping in API handlers.
- Add tooling that enforces architectural claims.
- Establish a clear production-readiness baseline for Loom and the platform.
Priority Framework
P0
The project is currently making a strong claim that is false or unverifiable.
P1
The system works, but a restart, deployment, or operational incident would expose a structural weakness.
P2
The system is usable, but confidence is limited by missing enforcement, coverage, or operational ergonomics.
P3
Valuable follow-up hardening after the major truth gaps are closed.
Workstreams
Workstream 1: Restore Verification Integrity
Priority: P0
Problem
The repo fails pnpm turbo typecheck, so the project cannot currently claim clean repo-wide TypeScript verification.
Required changes
- Fix Loom typecheck so it succeeds from a clean checkout.
- Remove or stabilize the dependency on stale
.next/typesartifacts. - Make sure
pnpm turbo typecheck,pnpm turbo test, andpnpm turbo buildall pass in a fresh environment.
Acceptance criteria
pnpm turbo typecheckpasses from a clean checkout.pnpm turbo testpasses from a clean checkout.pnpm turbo buildpasses from a clean checkout.- CI runs all three commands.
Likely implementation steps
- Adjust apps/loom/tsconfig.json so generated type includes are not brittle.
- Document the correct Next.js type-generation workflow if generation must remain.
- Add CI to verify the monorepo in the same way developers are expected to verify it locally.
Workstream 2: Finish Critical Persistence
Priority: P0
Problem
Cambium states that important state should not be memory-only and that PostgreSQL backs durable state. This is not yet true across several important stores.
Required changes
- Implement PostgreSQL-backed Quorum policy storage.
- Move budget storage to PostgreSQL.
- Move audit storage to PostgreSQL with a correct schema and type model.
- Move Cortex intent storage to PostgreSQL.
- Persist lifecycle stores that represent durable system behavior.
Acceptance criteria
- No critical operational state disappears on process restart.
- Production mode in Loom does not depend on in-memory stores for governance, budgets, intents, or lifecycle state.
- Service wiring in services.ts uses PostgreSQL-backed stores for all durable concerns.
Specific deliverables
2.1 Quorum policies
- Add
policiestable to DB schema and migration set. - Implement
PgPolicyStore. - Replace in-memory policy store usage in Loom services.
Relevant files:
2.2 Budgets
- Add budget schema and migrations if not already complete enough.
- Implement
PgBudgetStore. - Replace
InMemoryBudgetStorein service wiring.
Relevant file:
2.3 Audit
- Decide whether audit should have a dedicated audit table or a corrected event-backed representation.
- Implement a durable
PgAuditStorepath that matches theAuditActionmodel. - Replace in-memory audit usage in service wiring.
Relevant file:
2.4 Cortex intents
- Resolve the store type mismatch preventing
PgIntentStoreusage. - Wire Cortex intent persistence through PostgreSQL.
Relevant file:
2.5 Lifecycle durability
- Persist cycle history.
- Persist topic state.
- Persist autonomous intents.
- Persist lifecycle compost state if it is intended to survive restarts.
Relevant file:
Workstream 3: Fix Auth Context and Workspace Scoping
Priority: P0
Problem
The app has API authentication, but workspace context is not consistently derived from authenticated request context. Some routes still hardcode workspace values.
Required changes
- Define a single request-context contract for API routes.
- Propagate
workspace_idfrom middleware or equivalent auth context. - Remove hardcoded workspace defaults from route handlers where the route should be context-aware.
Acceptance criteria
- All authenticated API routes derive workspace context consistently.
- No route handling mutable or sensitive data hardcodes
'default'as an operational fallback unless explicitly intended for dev-only mode. - Route tests cover unauthorized, wrong-workspace, and happy-path cases.
Relevant file
Workstream 4: Enforce Architectural Claims in Tooling
Priority: P1
Problem
Several project rules are currently conventions rather than enforceable guarantees.
Required changes
- Add package-boundary enforcement.
- Add circular dependency detection.
- Add CI checks for these rules.
Acceptance criteria
- A dependency violation fails CI.
- A circular dependency fails CI.
- Internal domain layering rules are documented and machine-checked.
Candidate tools
dependency-cruisermadge- ESLint import rules if they are sufficient for the chosen boundary model
Workstream 5: Establish E2E Confidence for Loom
Priority: P1
Problem
Loom builds and has a middleware unit test, but there is no visible browser-level end-to-end coverage.
Required changes
- Add Playwright or equivalent E2E coverage for core operator flows.
- Cover at least:
- viewing workflows
- starting a run
- viewing run detail
- viewing providers
- auth middleware protection on API routes
Acceptance criteria
- A small but meaningful E2E suite runs in CI.
- Loom’s critical operator paths are validated in a running app, not only at unit level.
Workstream 6: Harden Production Mode
Priority: P1
Problem
The app can build and run, but production-mode operational assumptions are still loose.
Required changes
- Define the supported production deployment profile explicitly.
- Add startup checks for required env vars in production mode.
- Make persistence mode selection explicit and safe.
- Ensure provider health monitors and background loops behave predictably in production boot.
Acceptance criteria
- Production startup fails fast on missing required configuration.
- There is a documented and tested “supported production config.”
- The service container does not silently start in a memory-backed mode when production durability is expected.
Workstream 7: Rationalize OAuth and Auth Operations
Priority: P2
Problem
OAuth support exists, but the operational path is still easy to misconfigure and still coexists with a stub implementation.
Required changes
- Make the supported OAuth flow explicit.
- Ensure provider templates, env requirements, and callback handling form one coherent path.
- Decide whether the stub flow remains test-only or should be removed from public exports.
Acceptance criteria
- A provider with OAuth can be configured end to end using documented steps.
- Misconfiguration errors are explicit and operator-readable.
- Tests cover both success and common failure modes.
Workstream 8: Clarify V1 Scope Boundaries
Priority: P2
Problem
Some subsystems are intentionally V1-limited, but the current docs and code can blur the line between “not yet built” and “deliberately deferred.”
Required changes
- Mark intentional V1 limits clearly in docs.
- Distinguish between:
- implemented
- partial
- deferred
Current examples
- Lifecycle scanner is RSS-only in V1.
- Some auth and workspace concerns are single-workspace simplifications.
Acceptance criteria
- The docs stop overstating maturity.
- Future contributors can tell whether a gap is a bug, debt, or deliberate scope limit.
Recommended Sequence
Phase 1: Make the repo truthful
- Fix Loom typecheck and CI verification.
- Add Quorum policy persistence.
- Add budget persistence.
- Add audit persistence.
Phase 2: Make the runtime durable
- Add Cortex intent persistence.
- Add lifecycle persistence.
- Remove process-memory reliance for critical production state.
Phase 3: Make the app operationally coherent
- Thread workspace/auth context through API routes.
- Add production-mode configuration guards.
- Harden OAuth operations.
Phase 4: Make the claims enforceable
- Add boundary and dependency tooling.
- Add Loom E2E coverage.
- Update docs to match reality.
Definition of “Production-Ready Enough”
Cambium should be considered ready for a serious production pilot when all of the following are true:
- Repo verification passes cleanly in CI and locally.
- No critical subsystem loses state on restart.
- Authenticated API routes derive workspace context consistently.
- Governance policy, budgets, intents, audit, and lifecycle state are durable.
- Boundary and dependency checks are automated.
- Loom has at least minimal end-to-end operator-flow coverage.
- Production configuration is explicit and validated at boot.
What Not To Do Yet
Until the P0 and core P1 work is done, avoid prioritizing:
- broader provider ecosystem expansion
- richer lifecycle source types beyond the current V1 scanner scope
- more Loom surface area
- new biology-themed subsystem concepts
The maturity bottleneck is not ideation. It is truth, durability, and enforcement.
Suggested Immediate Next Tasks
The next concrete execution plan should start with these items, in order:
- Fix
@cambium/loomtypecheck so the monorepo verifies cleanly. - Implement persistent Quorum policies.
- Implement persistent budgets.
- Implement persistent audit storage.
- Remove hardcoded workspace assumptions from API routes.
If these are complete, the project’s public claims become materially more trustworthy without changing its product direction.