Skip to content

feat: ScenarioBranch facade + LF integration mapping v1#265

Merged
AdaWorldAPI merged 2 commits into
mainfrom
claude/scenario-world-facade
Apr 25, 2026
Merged

feat: ScenarioBranch facade + LF integration mapping v1#265
AdaWorldAPI merged 2 commits into
mainfrom
claude/scenario-world-facade

Conversation

@AdaWorldAPI
Copy link
Copy Markdown
Owner

Summary

  • ScenarioBranch facade in contract::scenario (~340 LOC, 7 tests) — named handle composing Pearl Rung 3 intervention, Lance versioning, archetype meta-state, and WorldModelDto gestalt into explicit counterfactual branching
  • Wire archetype::World::fork/at_tick from Unimplemented stubs to working implementations (URI-suffix branching + tick rewind validation)
  • scenario-world agent card (315 LOC) — full decision rationale: why LF-71 column dropped, what NARS/Archetype/ONNX/Chronos/Temporal each contribute, three-resolution diff explanation
  • LF integration mapping v1 (293 LOC plan) — comprehensive status of all 45 LF/W chunks: 17 DONE, 2 IN-PR, 22 QUEUED, 2 DEFERRED, 2 FUTURE, with sequencing for next 10 chunks
  • ScenarioWorldCounterfactual.md design doc (299 LOC) covering the full architecture

Stage 7 redesign (LF-70/71/72)

LF Original This PR
LF-70 World::fork full impl Wired: archetype::World::fork + ScenarioBranch::new with fork_seed, archetype_prior, interventions
LF-71 scenario_id column on every BindSpace SoA row DROPPED — would widen SIMD sweep 8B/row + duplicate Lance versioning. Scenario identity = role-bind in trajectory + dataset-path branch.
LF-72 diff(base, fork) ScenarioDiff composing three resolutions: graph-node + fingerprint-Hamming + gestalt-dissonance

New chunks added (LF-73/74/75 — queued, not implemented)

  • LF-73: simulate_forward — wires dormant NarsInference::CounterfactualSynthesis
  • LF-74: forecast_palette — Chronos-extracted compose-chain method over existing 256-archetype palette
  • LF-75: replay — Apache-Temporal-extracted deterministic replay via fork_seed

Test plan

  • cargo test -p lance-graph-contract --lib scenario — 7 passed
  • cargo test --manifest-path crates/lance-graph-archetype/Cargo.toml --lib — 16 passed
  • cargo clippy -p lance-graph-contract -p lance-graph-archetype — clean on new files
  • cargo check — full workspace clean

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh


Generated by Claude Code

claude added 2 commits April 25, 2026 15:39
…enario-world agent

Three additive changes that compose existing pieces (Pearl Rung 3
intervention, Lance versioning, archetype meta-state, WorldModelDto)
into a first-class explicit scenario branching surface.

contract/scenario.rs (NEW, ~340 LOC including tests):
  ScenarioBranch — named handle with parent_tag, fork_seed,
    archetype_prior, intervention list, default NARS inference mode.
  ScenarioDiff — three-resolution gestalt diff (graph / fingerprint /
    world-model). Composes VersionedGraph::diff + worlds_differ +
    WorldModelDto.field_state.dissonance.
  ScenarioWorld trait — fork / simulate_forward / forecast_palette /
    diff_branches / replay. Zero-dep; concrete impls live downstream.
  7 unit tests, all pass.

archetype/world.rs (WIRE, was Unimplemented):
  fork(branch) — appends ?branch=<name> URI suffix, resets tick.
    Empty branch name → InvalidBranch.
  at_tick(tick) — clones with rewound tick, validates tick <= current,
    InvalidTick if requested > current.
  Archetype crate stays lance-free per ADR-0001; downstream resolver
    translates URI suffix → VersionedGraph::tag_version + new dataset
    path.
  6 new tests, 16 total pass.

archetype/error.rs (EXTEND):
  + InvalidBranch
  + InvalidTick { requested, current }

.claude/agents/scenario-world.md (NEW):
  Specialist agent with the full decision tree:
    - Time travel vs branching vs intervention (three operations,
      not one).
    - Why scenario_id column was rejected (5 reasons including
      I-VSA-IDENTITIES violation).
    - Why a separate scenarios crate was rejected.
    - Why URI-suffix branching (keeps archetype lance-free).
    - Why CounterfactualSynthesis as default inference mode.
    - Why fork_seed (Apache-Temporal-extracted determinism).
    - Why palette compose-chain forecast (Chronos-extracted method).
    - Why three-resolution diff (gestalt structure preservation).
  LF-80/81 reframing: marketplace = portable auditable counterfactuals,
    not speculative bundle distribution. Becomes enterprise anchor
    product when ScenarioBundle = Ontology + ScenarioBranch set +
    ModelBinding + AuditEntry chain + spider-rs evidence URLs.

docs/ScenarioWorldCounterfactual.md (NEW):
  Cross-cutting design doc with TL;DR, decision summary table, tools
  considered (NARS / Archetype / ONNX / Chronos / Apache Temporal)
  and what each contributed, three-resolution diff explanation, and
  the LF-80/81 reframing for regulated industries.

240 contract + 16 archetype tests pass. Workspace cargo check clean.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
Comprehensive map of all 41 LF + 4 W chunks shipped or queued across
the lance-graph workspace. Producer-side mirror of SMB session's
foundry-parity-checklist.md; lives in lance-graph so future producer
sessions see the state at a glance.

Status totals:
  17 DONE (Tier 1 LF-1..8 + W-1..4 + LF-21/22/90/91/92)
   2 IN-PR (LF-70, LF-72 on this branch via ScenarioBranch facade)
  22 QUEUED (Stage 1 connectors, Stage 2 ontology adds, Stage 3 storage,
             Stage 4 search, Stage 5 models, Stage 6 decisions,
             Stage 7 LF-73/74/75 forward-sim wiring)
   2 DEFERRED (LF-32 sharded writes, LF-53 AIP Logic UI)
   2 FUTURE (LF-80/81 marketplace bundles)

Stage 7 redesign documented:
  LF-71 (scenario_id column) DROPPED — would widen SIMD sweep + duplicate
    Lance versioning. Replaced with role-bind + dataset-path branch identity.
  LF-73 simulate_forward — wires existing dormant CounterfactualSynthesis
    NARS inference type into ScenarioWorld trait.
  LF-74 forecast_palette — Chronos-extracted method (compose-chain over
    existing 256-archetype palette + ComposeTable). Adopt the idea,
    don't pull in the model.
  LF-75 replay — Apache-Temporal-extracted method (deterministic replay
    via captured fork_seed). Adopt the idea, don't adopt durable-execution
    workflow runtime.

Sequencing recommendation for next 10 chunks ordered by leverage:
  1. Merge this branch (Stage 7 + scenario-world agent)
  2. LF-12 Pipeline DAG (unblocks Stage 1 connector tier)
  3. LF-50/52 ModelRegistry + LlmProvider (xAI/OpenAI/Anthropic/Ollama)
  4. LF-20 FunctionSpec
  5. LF-23 NotificationSpec
  6. LF-31 scan_as_of (almost-free trait expose of existing VersionedGraph)
  7. LF-10 Connector registry
  8. LF-61 NARS-revision-on-correction
  9. LF-73 simulate_forward
  10. LF-40 Tantivy full-text search

INTEGRATION_PLANS.md prepended with new v1 entry per board hygiene rule.

https://claude.ai/code/session_01SbYsmmbPf9YQuYbHZN52Zh
@AdaWorldAPI AdaWorldAPI merged commit 90c8a2d into main Apr 25, 2026
0 of 5 checks passed
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 0289567a11

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

let separator = if self.dataset_uri.contains('?') { "&" } else { "?" };
Ok(World {
tick: 0,
dataset_uri: format!("{}{}branch={}", self.dataset_uri, separator, branch),
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Percent-encode branch names in forked dataset URI

The branch name is interpolated directly into the query string, so names containing reserved characters (for example &, #, or spaces) produce an ambiguous or malformed URI and can resolve to the wrong branch downstream (e.g., branch=a&b is parsed as branch=a). Since fork accepts arbitrary non-empty branch names, this can silently misroute scenario writes/reads in real workloads where names come from user-defined scenario labels; the branch value should be URL-encoded (or stored separately from URI text) before concatenation.

Useful? React with 👍 / 👎.

AdaWorldAPI pushed a commit that referenced this pull request Apr 25, 2026
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