Skip to content

docs(OGAR): consumer best-practices guide + classid-is-address precision#100

Merged
AdaWorldAPI merged 1 commit into
mainfrom
claude/medcare-bridge-lance-graph-wmx76z
Jun 22, 2026
Merged

docs(OGAR): consumer best-practices guide + classid-is-address precision#100
AdaWorldAPI merged 1 commit into
mainfrom
claude/medcare-bridge-lance-graph-wmx76z

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

Two coupled sharpenings, born from cross-session corroboration on the GUID layout question (parallel session shipped lance-graph #591 with the same address-vs-magic precision — two independent sessions converging on the framing is the muscle these docs together drill).

Four files

1. docs/OGAR-CONSUMER-BEST-PRACTICES.md (new) — the muscle-memory guide

Pattern-centric, example-heavy. Every claim shown with a real classid value and a real consumer. Designed for cross-session muscle memory, per operator request.

  • §0 — the one-line invariant: "classid is pure address; magic is what it resolves to" + three drilled corollaries
  • §1 — address anatomy: worked examples for 0x0000_0901 (canonical patient) · 0x0005_0901 (Medcare's render) · 0x0001_0102/0x0007_0102 (WorkPackage/Issue, same concept different render) · the five-way BILLABLE_WORK_ENTRY convergence pin (0x0003_0103/0x0004_0103/0x0001_0103/0x0007_0103/0x0002_0103). APP allocation table + domain byte table.
  • §2 — the four canonical consumer patterns, each with ✅ canonical + ❌ anti:
  • §3 — anti-pattern catalogue (7 entries), each paired with its right-shape §reference
  • §4 — worked migration narrative: Medcare's patient end-to-end through all four patterns
  • §5 — Knowledge Activation triggers + agents that load Tier-1
  • §6 — cross-refs (incl. lance-graph #591 as parallel-session sibling)

2. docs/SURREAL-AST-TRAP-PREFLIGHT.md — §0 prefix added

Sharpens the spellbook with the precision from #591: "the classid is pure address; the magic is what it resolves to." Explains why the trap is structurally impossible to fix from inside DDL — SurrealQL has the address but not the Core types behavior resolves to, so encoding lifecycle in DEFINE EVENT is putting the value into the key.

3. CLAUDE.md — registered

4. docs/APP-CLASS-CODEBOOK-LAYOUT.md — cross-ref added

Top-of-doc pointer to the muscle-memory guide; reinforces the hi-u16 = render magic ≠ class magic distinction (the precision I missed in my first pass).

The address-vs-magic precision (the sharpening)

classid : u32  =  0xAAAA ‖ 0xDDCC                       (8 nibbles, BOTH halves = address)
                    │         │
                    │         └─ lo u16: WHICH CONCEPT  (shared identity)
                    └─────────── hi u16: WHOSE RENDER   (per-app skin)

         ──────►  resolves to  ──────►
                     ├─ ClassView           the SKIN     (render — per-app, picked by hi)
                     ├─ Class               the SHAPE    (structural — canonical, picked by lo)
                     └─ ActionDef +         the MAGIC    (behavioral — lifecycle, callbacks,
                        KausalSpec                        validations; ALWAYS in OGAR Core,
                                                         NEVER in the address or in DDL)

The classid carries no magic. Class-magic (rails ActiveRecord-style callbacks, lifecycle, validations) is a property of the Core node the address resolves to — never of the address itself. The hi u16 picks render magic (which app's template), never class magic.

This is why the trap spellbook (#99) forbids smuggling behavior into DDL: DDL has the address but not the Core types it resolves to.

Cross-session convergence — same shape, two domains

Session Spellbook Cast for
OGAR #99 (mine) docs/SURREAL-AST-TRAP-PREFLIGHT.md spine governance
OGAR #100 (this PR) docs/OGAR-CONSUMER-BEST-PRACTICES.md consumer muscle memory
lance-graph #591 (parallel) .claude/knowledge/ogar-consumer-preflight.md + ISS-CONTRACT-APP-PREFIX-MIRROR Core-gap entry spine-side consumer

Doc-only PR. Nothing code-side touched.

🤖 Generated with Claude Code

https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP


Generated by Claude Code

Two coupled sharpenings of the consumer-side doctrine, born from cross-
session corroboration on the GUID layout question:

1) New OGAR-CONSUMER-BEST-PRACTICES.md — the muscle-memory guide.
   Pattern-centric, example-heavy. Drilled with worked classid values
   across every consumer (medcare 0x0005_0901, woa 0x0003_0103, smb
   0x0004_0204, odoo 0x0002_0103, openproject 0x0001_0102, redmine
   0x0007_0102, the 5-way BILLABLE_WORK_ENTRY convergence pin):

   §0 the one-line invariant + three drilled corollaries
   §1 address anatomy with concrete hi/lo examples + APP allocation
      table + domain byte table
   §2 the four canonical patterns:
      Pattern 1 — pull classid (Port::class_id)
      Pattern 2 — compose render classid (APP_PREFIX | concept)
      Pattern 3 — authorize by classid (interim until keystone)
      Pattern 4 — distill/migrate from legacy bridge (4a one-line
                  import repoint; 4b full structural drop)
      Each pattern shown with ✅ canonical + ❌ anti shapes.
   §3 anti-pattern catalogue paired with right-shape references
   §4 worked migration narrative — Medcare patient end-to-end
   §5 activation triggers + agents that load Tier-1
   §6 cross-refs (incl. lance-graph #591 parallel-session sibling)

2) SURREAL-AST-TRAP-PREFLIGHT.md §0 — sharpens the spellbook with the
   precision from lance-graph #591: "the classid is pure address; the
   magic is what it resolves to." Explains why the trap is structurally
   impossible to fix from inside DDL — SurrealQL has the address but
   not the Core types behavior resolves to, so encoding lifecycle in
   DEFINE EVENT is putting the value into the key. Cross-link to best-
   practices guide added to §Cross-refs.

3) CLAUDE.md — registered best-practices guide as doc-family #8; added
   matching non-negotiable ("Consumer call sites: classid is address,
   magic is at the resolution target") under the existing SurrealQL
   non-negotiable.

4) APP-CLASS-CODEBOOK-LAYOUT.md — top-of-doc cross-ref to the new
   muscle-memory guide; reinforces hi-u16 = render magic ≠ class magic
   distinction.

Companions to lance-graph #591 (parallel session's
`.claude/knowledge/ogar-consumer-preflight.md` + ISS-CONTRACT-APP-
PREFIX-MIRROR Core-gap entry) — same spellbook pattern, cast in two
domains. Two independent sessions converging on the address-vs-magic
precision is the muscle the two docs together drill across every
future consumer-side session.

Doc-only PR; no code touched.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP
@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, you can upgrade your account or add credits to your account and enable them for code reviews in your settings.

@AdaWorldAPI AdaWorldAPI merged commit 26ae4e9 into main Jun 22, 2026
1 check passed
AdaWorldAPI pushed a commit that referenced this pull request Jun 22, 2026
…aph #592 coordination loop

PR #592 (parallel session) closed `ISS-CONTRACT-APP-PREFIX-MIRROR` by
mirroring OGAR #97's `PortSpec::APP_PREFIX` / `render_classid_for` into
`lance_graph_contract::ogar_codebook` as `AppPrefix` +
`render_classid_for_concept` (wire-compat, parity-pinned, no `ogar-vocab`
dep). Its coordination note left the OGAR-side companion — the
spine-vs-membrane import-path distinction in OGAR #100 §2 — to this
session.

This commit closes that loop. Changes to docs/OGAR-CONSUMER-BEST-PRACTICES.md:

§2 — new preface block: pins the BBB-barrier rule (spine-internal crates
freely depend on `ogar-vocab`; membrane crates restricted to
`lance-graph-contract` only), with the allowed-deps × canonical-path
table. Both paths return identical classids — the choice is dep-tree
posture, not concept identity.

Pattern 1 split — Pattern 1a (spine, `ogar_vocab::ports::*Port::class_id`)
+ Pattern 1b (membrane, `lance_graph_contract::ogar_codebook::canonical_concept_id`).

Pattern 2 split — Pattern 2a (spine, `*Port::APP_PREFIX | concept`) +
Pattern 2b (membrane, `AppPrefix::*.render(cid)` or
`render_classid_for_concept(AppPrefix::*, name)` — the one-call helper).
Cites lance-graph #592, names the parity test
`app_prefixes_match_ogar_allocation_table` as the drift fuse.

§5 trigger phrases — extended with `BBB-barrier` ·
`contract::ogar_codebook` · `canonical_concept_id` · `AppPrefix` ·
`render_classid_for_concept` · `lance_graph_contract::ogar_codebook` ·
`membrane consumer` · `spine vs membrane`.

§6 cross-refs — sharpened lance-graph #591 entry (surfaced the gap) and
added lance-graph #592 entry (closed it with the membrane mirror).

Patterns 3 + 4, §3 anti-pattern catalogue, §4 worked Medcare migration
narrative — unchanged (they're correct as-is; the membrane variant
inherits from the new 1b/2b without further branching).

Docs-only. Closes the consumer/membrane half of the
ISS-CONTRACT-APP-PREFIX-MIRROR coordinated fix.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01EYvNjD8M8LMNYbRy3gq2FP
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.

2 participants