Skip to content

Implement persistent native agent state - #2

Closed
safranchik wants to merge 1 commit into
mainfrom
feature/native-agent-state
Closed

Implement persistent native agent state#2
safranchik wants to merge 1 commit into
mainfrom
feature/native-agent-state

Conversation

@safranchik

@safranchik safranchik commented Aug 6, 2026

Copy link
Copy Markdown
Owner

Summary

This change makes each mn.Parameter the persistent native state of one owner agent.

  • Forward creates a disposable episode fork from a read-only Parameter.
  • Backward resumes the episode and accumulates structured directional feed.
  • DFM.step() resumes each persistent owner once with all accumulated feed.
  • Owner updates run in parallel and promote as one atomic model generation.
  • Shared, recurrent, retained, and frozen Parameter graphs follow PyTorch-shaped behavior.
  • Pi, Codex, Claude Code, OpenCode, Hermes, and Prime Agent use isolated native state.
  • The FFT discovery example provides an exact, resumable research workload.

Lifecycle

forward()                 temporary episode forks
loss.backward()           accumulate Parameter.feed
optimizer.step()          one owner reduction per Parameter
optimizer.zero_feed()     clear accumulated feed

Forward and backward cannot mutate canonical Parameter state. Episode state is never merged or promoted. Git remains private to HyTorch and provides atomic model generations.

Safety

  • Keep credentials outside persisted Parameters.
  • Reject nested Git metadata, escaping symlinks, and special files.
  • Limit native state to 100,000 files and 2 GiB.
  • Preserve feed after a failed reducer so the caller can retry or clear it.
  • Roll back the complete step candidate if any owner reducer fails.

Validation

The complete offline suite passed on Python 3.11, 3.12, and 3.13:

  • 111 passed
  • 2 opt-in real-provider tests skipped
  • uv lock --check
  • uv run ruff check .
  • uv run ruff format --check .
  • uv build
  • git diff --check

@safranchik safranchik closed this Aug 6, 2026
@safranchik safranchik reopened this Aug 6, 2026
@safranchik safranchik closed this Aug 6, 2026
@safranchik
safranchik deleted the feature/native-agent-state branch August 6, 2026 23:31
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