Skip to content

feat(agent): add recursive reflector - #101

Merged
Pepps233 merged 2 commits into
feat/reserve-counter-contractsfrom
feat/recursive-reflector
Aug 23, 2026
Merged

Pepps233 merged 2 commits into
feat/reserve-counter-contractsfrom
feat/recursive-reflector

Conversation

@Pepps233

@Pepps233 Pepps233 commented Aug 20, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Implements the bounded recursive Reflector over immutable, cursor-addressed evidence slices without enabling later Curator, Validator, Writer, or Counter behavior.

The Reflector now analyzes large evidence corpora through isolated read-only tools, synthesizes validated lesson trees within explicit budgets, records complete evidence coverage, and resumes from durable node checkpoints without repeating completed work.

Reasoning

Reliable reflection requires evidence boundaries that remain stable after materialization and cannot be changed or widened by model tool calls.

Treating each materialized evidence record as the smallest indivisible semantic unit allows slices to shrink, split, and request adjacent context without breaking tool-call, tool-result, or turn boundaries.

A dedicated job-scoped tool registry prevents Reflector capabilities from leaking into foreground sessions or later model stages, while request and result digests make every authorized read auditable.

Persisting each validated node and its lessons before appending a ledger checkpoint gives interrupted jobs a durable resume point and preserves model and tool accounting across retries.

Explicit depth, round, model-call, tool-call, and Curator-fit limits keep recursion bounded and fail closed when the Reflector cannot produce a valid result.

Changes

  • Enrich evidence corpus manifests with materialization identity, ordered semantic units, safe source cursors, diagnostics, causal links, and stable digests.
  • Add job-scoped read-only tools for document listing, outlines and metadata, literal search, contiguous slice reads, adjacent context, and slice refinement.
  • Add recursive leaf analysis and intermediate synthesis with explicit resource budgets and a default five-round cap.
  • Detect open evidence edges and preserve continuation links when oversized logical sequences must span multiple slices.
  • Validate lesson fields, evidence closure, result digests, coverage dispositions, and the final Curator-fit lesson bound.
  • Record Reflector tool calls, denials, model calls, and completed-node checkpoints in the evolution ledger.
  • Persist each completed reflection node and its lessons before recording its resumable checkpoint.
  • Keep Reflector tools structurally unavailable to Curator requests and revoke registry handles after execution.
  • Add focused coverage for immutable registries, recursive synthesis, hard budgets, malformed responses, injection resistance, isolation, and crash-resume behavior.

Testing

  • node ../../node_modules/vitest/dist/cli.js --run test/reflector.test.ts test/control-plane.test.ts
  • npm run check
  • ./test.sh

- Preserves materialized evidence as immutable semantic-unit slices with audited read-only access
- Checkpoints validated reflection nodes so interrupted jobs resume without repeating completed work
- Enforces immutable registry inputs, hard budgets, and Curator-fit completion before checkpointing
- Preserves retry semantics and provenance across interrupted model calls and refined slices
@Pepps233 Pepps233 self-assigned this Aug 20, 2026
@Pepps233
Pepps233 requested a review from Issacboy123 August 20, 2026 01:00
@Pepps233
Pepps233 marked this pull request as ready for review August 23, 2026 16:37
@Pepps233
Pepps233 merged commit d968205 into main Aug 23, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant