Source-Contract Decision — Onasis-CORE #54 (prefer_cache gap)
Source-Contract Decision Record
ID: SCD-2026-08-08-onasis-core-54-prefer-cache
Status: Open (source-contract gap, not patched from docs)
Owner: Onasis-CORE maintainers (Edge Function + OpenAPI contract)
Summary
prefer_cache is implemented and used by the intelligence-analyze-patterns Edge Function but is absent from the AnalyzePatternsRequest schema in the Onasis-CORE OpenAPI contract. This mismatch was raised during the review of Onasis-CORE #54 and remains a known source-contract gap.
Evidence
-
Review comment on Onasis-CORE #54 (path
docs/supabase-api/SUPABASE_REST_API_OPENAPI.yaml, line 1997):The
AnalyzePatternsRequestschema is missing theprefer_cacheproperty, which is implemented and used in theintelligence-analyze-patternsEdge Function (seesupabase/functions/intelligence-analyze-patterns/index.ts). Adding this property to the OpenAPI contract ensures that clients are aware of this parameter and can utilize the pre-reasoned conclusions layer. -
Implementation exists in the Edge Function:
supabase/functions/intelligence-analyze-patterns/index.ts:36—prefer_cache?: booleansupabase/functions/intelligence-analyze-patterns/index.ts:84-104— prefer_cache layer reads pre-reasoned conclusions before calling the LLM
-
OpenAPI contract gap (verified 2026-08-08 against
apps/onasis-core):docs/supabase-api/SUPABASE_REST_API_OPENAPI.yaml:1997-2034—AnalyzePatternsRequestincludestime_range_days,include_insights,response_format,organization_id,topic_id,memory_type,memory_types,query_scope— noprefer_cache.
Decision
This docs repository does not patch Onasis-CORE. The fix belongs in the Onasis-CORE repository (OpenAPI source of truth), and the docs card that depends on it should be updated after the contract is corrected.
Recommended Onasis-CORE change (from the review comment, to be applied by Onasis-CORE maintainers):
query_scope:
$ref: '#/components/schemas/MemoryQueryScope'
description: Scope hint for personal vs organization memory analysis
prefer_cache:
type: boolean
default: false
description: If true, return pre-reasoned conclusions before calling LLM
Impact on docs
- REST/OpenAPI-derived docs will reflect
prefer_cacheonly after Onasis-CORE #54 follow-up lands and the docs source sync is re-run. - The MCP surface (MCP tool docs) is unaffected by this gap; it is scoped to the REST OpenAPI contract.
- No docs example in this repository currently claims
prefer_cacheonAnalyzePatternsRequestvia REST.
Acceptance for closing
- Onasis-CORE PR adds
prefer_cachetoAnalyzePatternsRequestinSUPABASE_REST_API_OPENAPI.yaml. - Docs source sync (
scripts/sync-docs-specs.js) regenerates without drift (bun run check:docs-sync). - This decision record is updated to
Closedwith the Onasis-CORE commit SHA.