Skip to content

feat: implement Phase 3 state reconstruction and structural slice - #4

Merged
DSCmatter merged 2 commits into
mainfrom
feat/phase3
Aug 24, 2026
Merged

feat: implement Phase 3 state reconstruction and structural slice#4
DSCmatter merged 2 commits into
mainfrom
feat/phase3

Conversation

@DSCmatter

@DSCmatter DSCmatter commented Aug 24, 2026

Copy link
Copy Markdown
Contributor

User description

  • core/reducer.py: pure event fold, reconstruct() with snapshot shortcut and SHA-256 state hashing
  • core/snapshots.py: interval snapshots (32 events/agent) + integrity verification
  • core/slicing.py: structural_slice (SQL-first, BFS fallback) and why() decision evidence
  • storage/postgres.py: event range fetch + snapshot persistence
  • cli/main.py: agents/slice/why/reconstruct vs fixture or Postgres
  • tests: four mandated property tests, fixture contract, integration
  • tooling: scripts/test_phase3.ps1; README + TEST.md updated

pytest/ruff/ty green, integration verified against real Postgres.


CodeAnt-AI Description

Add state reconstruction and causal decision debugging for event logs

What Changed

  • Rebuilds an agent’s state at any point in its event history, including memory, tool activity, context, outputs, and status.
  • Adds verified checkpoints that shorten later reconstruction and detect corrupted state.
  • Adds structural event slicing that follows declared causal parents, with deterministic results and PostgreSQL support.
  • Adds why evidence for decisions, including declared cross-agent inputs and mismatches between recorded values and event payloads.
  • Adds fixture and PostgreSQL CLI workflows for listing agents, slicing events, inspecting decision evidence, and reconstructing state.
  • Adds unit, property, CLI, and integration coverage plus Phase 3 validation and usage documentation.

Impact

✅ Reconstructable agent state at any event sequence
✅ Faster replay after snapshot checkpoints
✅ Clearer causal evidence for failed decisions

💡 Usage Guide

Checking Your Pull Request

Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.

Talking to CodeAnt AI

Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:

@codeant-ai ask: Your question here

This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.

Example

@codeant-ai ask: Can you suggest a safer alternative to storing this secret?

Preserve Org Learnings with CodeAnt

You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:

@codeant-ai: Your feedback here

This helps CodeAnt AI learn and adapt to your team's coding style and standards.

Example

@codeant-ai: Do not flag unused imports.

Retrigger review

Ask CodeAnt AI to review the PR again, by typing:

@codeant-ai: review

Check Your Repository Health

To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.

- core/reducer.py: pure event fold, reconstruct() with snapshot shortcut
  and SHA-256 state hashing
- core/snapshots.py: interval snapshots (32 events/agent) + integrity
  verification
- core/slicing.py: structural_slice (SQL-first, BFS fallback) and why()
  decision evidence
- storage/postgres.py: event range fetch + snapshot persistence
- cli/main.py: agents/slice/why/reconstruct vs fixture or Postgres
- tests: four mandated property tests, fixture contract, integration
- tooling: scripts/test_phase3.ps1; README + TEST.md updated

pytest/ruff/ty green, integration verified against real Postgres.
@DSCmatter DSCmatter self-assigned this Aug 24, 2026
@DSCmatter DSCmatter added documentation Improvements or additions to documentation enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files labels Aug 24, 2026
@codeant-ai

codeant-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown

🤖 CodeAnt AI — Review Status

Status Commit Started (UTC) Finished (UTC)
✅ Reviewed your PR fd0ccd3 Aug 24, 2026 · 07:00 07:06

@codeant-ai

codeant-ai Bot commented Aug 24, 2026

Copy link
Copy Markdown

Thanks for using CodeAnt! 🎉

We're free for open-source projects. if you're enjoying it, help us grow by sharing.

Share on X ·
Reddit ·
LinkedIn

@codeant-ai codeant-ai Bot added size:XXL This PR changes 1000+ lines, ignoring generated files and removed size:XXL This PR changes 1000+ lines, ignoring generated files labels Aug 24, 2026
Comment thread scripts/test_phase3.ps1 Outdated
Comment thread storage/postgres.py Outdated
@DSCmatter
DSCmatter merged commit f2fb581 into main Aug 24, 2026
2 checks passed
@DSCmatter
DSCmatter deleted the feat/phase3 branch August 24, 2026 15:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation enhancement New feature or request size:XXL This PR changes 1000+ lines, ignoring generated files

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant