Skip to content

Implement persistent native agent state - #3

Merged
safranchik merged 2 commits into
mainfrom
feature/persistent-native-agent-state
Aug 6, 2026
Merged

Implement persistent native agent state#3
safranchik merged 2 commits into
mainfrom
feature/persistent-native-agent-state

Conversation

@safranchik

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 merged commit 576e922 into main Aug 6, 2026
3 checks passed
@safranchik
safranchik deleted the feature/persistent-native-agent-state branch August 7, 2026 00:16
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