Co-authored-by: Sagnik <sagnik7896@gmail.com> Reviewed-on: sagnik/Project_Velocity#31
7.3 KiB
Oracle Canvas Codebook Production Truth
Date: 2026-04-19
Repo: Project_Velocity
Purpose
This document freezes the current production truth for the Oracle Canvas template/codebook system, the expanded GPT and Claude corpora, the runtime merge policy, and the current rendering limits that matter for delivery.
This is not a concept note. It is the implementation-facing truth for the Oracle template layer as it exists now.
Current Source Of Truth
The Oracle template book is split across three layers:
-
Structural database schema
backend/oracle/schema_extension_v2.sql- Defines:
oracle_template_chaptersoracle_template_subchaptersoracle_template_seed_examples- chapter/subchapter linkage on
oracle_component_templates oracle_synthetic_generation_jobs
-
Runtime seed DB
backend/oracle/oracle_template_seed_db.json- This is the lightweight fallback DB shipped with the runtime.
- It is structurally correct but incomplete relative to the intended corpus.
-
Expanded authoring corpora
- GPT pack:
Project_Velocity/.Agent Context/Sprint 1/Sayan Multi-Surface and Oracle Delivery Pack/Sample JSON Schema/GPT 5.4/oracle_canvas_json_expansion_pack/db/oracle_template_seed_db_expanded_v1.pretty.json
- Claude pack:
Project_Velocity/.Agent Context/Sprint 1/Sayan Multi-Surface and Oracle Delivery Pack/Sample JSON Schema/Claude Sonnet 4.6/oracle_template_expansion/oracle_template_seed_db_expanded.json
- GPT pack:
-
Frozen runtime merge artifact
backend/oracle/oracle_runtime_codebook_merged.json- This is the deploy-safe merged corpus generated from the GPT and Claude packs.
- Production should prefer this file over the authoring packs whenever it is present.
Corpus Status
The expanded corpora are materially useful and production-relevant.
GPT 5.4 pack
- Chapters:
6 - Subchapters:
24 - Seed examples:
1200 - Shape: already close to runtime needs
- Key field for examples:
seed_examples
Claude Sonnet 4.6 pack
- Chapters:
6 - Subchapters:
24 - Examples:
1200 - Key field for examples:
examples - Shape: close, but requires normalization into runtime form
Runtime fallback pack
- Chapters:
6 - Subchapters:
24 - Seed examples declared in metadata:
36 - Seed examples physically present: lower than metadata
- Useful only as a fallback, not as the primary production corpus
Super Codebook Policy
The current runtime now treats the codebook as a merged corpus rather than a single-file static DB.
The merge policy is:
- Load GPT pack first.
- Load Claude pack second.
- Load runtime fallback pack last.
- Normalize all example records to one runtime contract.
- Deduplicate by:
subchapter_idtemplate_nametitle
- Prefer in this order:
- GPT 5.4 examples
- canonical examples
- fallback records only when no richer example exists
This behavior is implemented in:
backend/oracle/codebook_service.pybackend/scripts/build_oracle_runtime_codebook.py
That file is now the effective runtime “super codebook” layer.
The generated runtime artifact currently contains the merged deployable corpus and is suitable for Linux-box deployment without requiring .Agent Context lookups at request time.
What The Runtime Actually Uses
The runtime no longer needs to rely on hardcoded template lists in the Oracle v1 router.
The codebook service now provides:
- merged corpus loading
- search over both corpora
- normalized template listing
- best-match template synthesis from a user prompt
Primary runtime functions:
codebook_service.stats()codebook_service.list_templates(...)codebook_service.search_examples(prompt, limit=...)codebook_service.synthesize_template(prompt, data_shapes=...)
Current Supported Runtime Output Families
The expanded corpora include more component types than the current frontend renderer supports directly.
The current production-safe strategy is:
- keep the full codebook corpus
- map high-variety codebook component families into a smaller supported runtime renderer set
- let Oracle render reliably today instead of failing on unsupported component types
Supported runtime renderers today
textCanvaskpiTilebarChartlineChartgeoMaptablepipelineBoardtimelineactivityStreamerrorNotice
Codebook-to-runtime normalization policy
Examples:
summary_card,summary_strip,metric_card_group,gauge_stack- mapped to
kpiTile
- mapped to
lead_profile_card,property_card,data_table,leaderboard_table,matrix_grid- mapped to
table
- mapped to
interaction_timeline,message_thread_summary- mapped to
activityStream
- mapped to
heatmap- mapped to
geoMap
- mapped to
This is deliberate. It keeps the UI stable while preserving the larger design vocabulary inside the template book.
What Is Production-Ready Now
- Oracle template DB schema exists.
- Oracle template taxonomy APIs exist.
- Expanded GPT and Claude corpora are available locally in the repo.
- Runtime codebook merge and retrieval is implemented in
codebook_service.py. - A frozen merged runtime codebook now exists at
backend/oracle/oracle_runtime_codebook_merged.json. - Oracle v1 template listing/synthesis is being moved to the codebook-backed path.
- Oracle backend can now emit
textCanvasplanning blocks and the frontend has a renderer for them.
What Is Still Constrained
- The runtime is not yet rendering all 47+ component families natively.
- The current system uses safe projection into supported runtime renderers.
- The template taxonomy routes existed, but were incorrectly using
user.roleastenant_id; that has been corrected toward a fixed Oracle tenant policy. - The lightweight fallback JSON DB remains incomplete and should not be treated as the main corpus.
What Nemoclaw / Oracle Should Use For Retrieval
The correct order for Oracle prompt handling is:
- Parse prompt.
- Retrieve matching codebook examples from the merged corpus.
- Build a safe retrieval plan against allowed DB datasets.
- Query live CRM/intelligence/inventory datasets.
- Build Oracle Canvas JSON with supported runtime component types.
- Append to the existing canvas.
The codebook is not the final UI payload by itself.
It is the reference layer that guides:
- component family selection
- chapter/subchapter intent
- layout direction
- data-shape expectations
- policy hints
- backend contract hints
Recommended Near-Term Hardening
- Materialize a generated runtime codebook file if Linux deployment should not depend on
.Agent Context. - Add explicit metadata versioning to the merged corpus.
- Add a small admin endpoint for codebook stats and source summary.
- Expand renderer coverage incrementally rather than trying to support all component families at once.
- Add a batch offline export path if the team wants a frozen deploy artifact.
Operator Bottom Line
The Oracle “book with chapters and JSON schema examples” is real and already useful.
The correct production interpretation is:
- DB schema and APIs are already present
- GPT and Claude expansion packs are the real high-value corpus
backend/oracle/codebook_service.pyis the runtime super-codebook layer- Oracle should retrieve from this merged corpus first, then query live DB data, then render supported JSON Canvas components