Skip to content

Support digest-backed state expansion for open agents - #10

Merged
michaelsutton merged 7 commits into
masterfrom
state-expansion
Jul 9, 2026
Merged

Support digest-backed state expansion for open agents#10
michaelsutton merged 7 commits into
masterfrom
state-expansion

Conversation

@michaelsutton

@michaelsutton michaelsutton commented Jul 9, 2026

Copy link
Copy Markdown
Collaborator

This PR adds digest-backed virtual slots for open-agent apps, and turns the old Open Lattice sketches into a compiling Open ICC lattice fixture.

Changes:

  • adds virtual <slot>; on base states
  • adds state X expands Base { slot: Memory; } bindings for concrete agent states
  • keeps the stored covenant layout identical to the base state
  • exposes expanded memory through slot-qualified Argent source, e.g. strategy.hunger
  • requires typed slot payload constructors, e.g. strategy: ForagerStrategy { ... }
  • lowers expanded memory reads through hidden fixed-size preimages
  • repacks mutated slot payloads back into the backing digest
  • teaches argent-runtime to accept slot-qualified source values and fill hidden preimage witnesses
  • allows expanded actors, like ForagerState expands AgentCapsule, to satisfy observed actor<AgentCapsule> handles
  • moves AgentCapsule into core.ag; agent.ag imports the core state view
  • replaces the old examples/open_lattice sketches with the real examples/open_icc fixture
  • regenerates tracked Open ICC build outputs
  • adds an execution test for Forager::step, including controller co-spend authorization and digest-backed strategy repacking

Example:

state AgentCapsule {
    covid controller_id;
    virtual strategy;
    int energy;
}

state ForagerStrategy {
    int hunger;
    int mood;
}

state ForagerState expands AgentCapsule {
    strategy: ForagerStrategy;
}

actor Forager owns ForagerState {
    entry step() emits {
        agent: Forager;
    } {
        ForagerState next_agent = {
            controller_id: controller_id,
            strategy: ForagerStrategy {
                hunger: strategy.hunger + 1,
                mood: strategy.mood,
            },
            energy: energy - 1,
        };

        become agent <- Forager(next_agent);
    }
}

The generated Sil stores the base layout only: controller_id, strategy, and energy. The ForagerStrategy preimage is Argent runtime/compiler plumbing: the contract verifies it against the stored strategy digest, exposes strategy.hunger and strategy.mood to source code, and writes mutations back as a new digest.

Allow runtime observed actor validation to accept actors whose source state expands the expected open observed base state, while still comparing the concrete storage field layout.

Add an open ICC regression that attaches a Forager actor owning ForagerState expands AgentState to a core expecting actor<AgentState>.
Lower expanded state fields as a source-level view over fixed storage digests. The compiler now verifies a packed hidden preimage, exposes memory fields as locals, and synthesizes digest fields when constructing expanded states.

Runtime builders accept flattened expanded-state fields, pack and hash them into storage, and provide the packed preimage as hidden entry material. The Sil ABI crate now exposes packed struct payload encoding for this runtime path.
Move the lattice-style cell and agent sketch into the compiling Open ICC examples. The core app now owns cell physics and observes a dynamic agent handle, while the agent app includes a Forager expanded state over AgentState.

Regenerate tracked Open ICC build outputs, remove the old open_lattice sketch folder, and keep artifact schema fixtures explicit about state expansions.
Define AgentState in the Open ICC core app and have the concrete agent app import that shared state view. This makes the dependency direction match the intended open-agent model: core publishes the interface, agents implement or expand it.

Regenerate tracked Open ICC artifacts after the import inversion.
Extend the Open ICC runtime regression to execute the real Forager::step path. The test co-spends a controller Cell input, builds a Forager output from flattened expanded-state fields, and verifies digest-backed memory is repacked correctly at script execution time.
Support digest-backed expanded state through virtual slots on base states and slot-qualified bindings on expanded states.

Base states can declare virtual slots such as virtual strategy; while expanded states bind them with strategy: ForagerStrategy;. Generated Sil keeps the stored digest field, and expanded actor code accesses memory through strategy.*.
@michaelsutton
michaelsutton merged commit ca86803 into master Jul 9, 2026
2 checks passed
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.

1 participant