Skip to content

E4: evidence-grounded reflection and wisdom cultivation - #35

Merged
drzo merged 6 commits into
mainfrom
feat/evolution-e4-evidence-metacognition
Nov 13, 2026
Merged

drzo merged 6 commits into
mainfrom
feat/evolution-e4-evidence-metacognition

Conversation

@drzo

@drzo drzo commented Oct 11, 2026 •

Copy link
Copy Markdown

E4: evidence-grounded metacognition

The next bounded Deep Tree Echo evolution strengthens persistent wisdom-cultivating autonomy while preserving the configurable charismatic/playful persona. All 553 Go files from o9nn/ecco9@1b22401ee8842fd1aa2769b688d588cd9f1f9ce9 are verified byte-identical in the existing local core integration. The implementation retains one canonical production scheduler/provider/ledger and the reviewed adapted_observed bridge instead of activating conflicting historical prototypes.

Implemented

Centre Change
Evidence reflection Bounded metacognition analyzer; full producer-DAG/citation validation; artifact Brier calibration; strict duplicate-key-rejecting JSON
Echobeats/EchoDream Real-model reflection.proposed at step 8; uncertainty-bearing hypotheses; durable replay/counters/quarantine; one-call pivot; deferred admission while prior practice remains open
Wisdom Removed generated-prose depth, unearned confidence, canonical dream wisdom increments and fabricated automatic effectiveness; unlocked provider calls and defensive snapshots
Scheduling Retention, callback/race/lifecycle fixes, immutable goal snapshots and replay-stable explicit-ID goals
Legacy concurrency Hub send/close and synchronous callback lock repairs; cancellation-aware commands; terminal lifecycle; progress worker join, spinner timer removal and bar synchronization
Sys6 All six concurrent MP1/MP2 workers join their cycle; metric-reader-compatible worker counters and Stop snapshots; actual concurrent computation preserved
Security Go 1.26.9 toolchain / 1.26.0 language baseline, x/net v0.60.0 and required x-module alignment; root/generated compatibility modules, CI pins, generator and autonomous Docker builder aligned
CI/status New race packages, scoped public reflection metrics, explicit historical wisdom qualification

Final local validation

Repository-wide tests, the full core/command/progress race suite, vet, CGO-disabled and CGO-enabled builds, module tidy/verify, diff hygiene and CI-matched lint all pass. Lint reports 0 new issues. Live Gemini inference over an actually created/read-back-verified local artifact produced a schema-valid, cited lesson/uncertainty/practice proposal without a competence award. Artifact Brier 0.010000 is operational calibration, not wisdom.

The initial hosted security scan found 13 reachable standard-library reports at the old Go pin. After upgrading the exact affected toolchain/network dependencies, local govulncheck v1.7.0 ./... passes with 0 reachable vulnerabilities, retaining one imported-package and one module-only finding not called by this code. The scan was not disabled or made nonblocking.

Documentation

Progress, review dispositions, commands and next frontier are recorded in docs/iterations/EVOLUTION_ITERATION_2026-10-11_E4.md, with the original implementation plan in docs/iterations/EVOLUTION_PLAN_2026-10-11_E4.md.

Residuals / next frontier

Artifact verification and valid citations do not establish semantic knowledge, moral wisdom or subjective awareness. Causal/hash provenance still assumes a trusted ledger writer; signed attestation and independent task-specific evaluators/hypothesis promotion are future work. RecordWisdomOutcome remains a caller-supplied legacy API, not a durable signed evaluator. Default enaction is observe; private-note planning does not grant public discussion/shell/network authority. No persistent deployment or public discussion adapter was added.

Legacy graphs/pattern queues/timer loops still need broader backpressure and unification. Large-ledger startup replays bounded pages but is linear in history. GitHub's default-branch aggregate of 1547 dependency alerts remains a repository-wide triage backlog, not a verified exploitability count for this runtime.

One transient cross-process core-self assertion was not reproducible on unchanged baseline/target after 1000 target runs plus 50 race runs; its security assertion was not weakened. Initial broad runs caught and drove the hub, progress and Sys6 corrections; final complete suites pass.

This PR makes no claim of full AGI or achieved wisdom and remains open for review; no auto-merge or force-push.

@cursor

cursor Bot commented Oct 11, 2026

Copy link
Copy Markdown

Bugbot is paused — on-demand spend limit reached

Bugbot uses usage-based billing for this team and has hit its on-demand spend limit.

A team admin can raise the spend limit in the Cursor dashboard, or wait for the next billing cycle to continue.

@drzo

drzo commented Oct 11, 2026

Copy link
Copy Markdown
Author

Final iteration close-out for commit 999028f: all 25 PR checks are SUCCESS and merge state is CLEAN. Comprehensive hosted CI passed Linux/macOS unit/race tests, integration tests, E2E, benchmarks, security scan, Docker build and architecture builds; CodeQL also completed successfully. Final local repository-wide tests, full core/command/progress race suite, vet, both CGO build modes, tidy/verify and new-issue lint passed. Live Gemini reflection and all 553 upstream Go-file SHA-256 comparisons passed. Worktree is clean and branch synchronized. PR is left open; no merge or persistent deployment was performed. Limits and next frontier remain in the committed E4 iteration report.

Bring E4 up to date with main (68ff221: #36, #37 and the E5 iteration,
#38) and resolve the 15 conflicted files.

Mechanical resolutions
- Go toolchain pins (go.mod, workflows, Dockerfile.autonomous, ecco9
  generator): main's go1.26.11 supersedes the branch's go1.26.9. The
  generated cognitive-core/ecco9/go.mod is aligned to the generator.
- go.mod and go.sum are identical to main; go mod tidy is a no-op.
- CI race package lists: main's list plus core/metacognition.
- progress/progress.go, progress/spinner.go: main's version (same
  lifecycle fix, formatting only differed).
- cognitive_event.go, orchestrator fields and replay switch, /status
  keys: both sides' additions kept.

Behavioural resolutions (main's accepted contract kept where the two
sides disagreed)
- productionIteration stays 2026-11-11-e5-evaluated-practice.
- Echobeats task failures record an empty Result (main's model-output-
  only contract) instead of E4's "generation failed: ..." text. E4's
  bounded task history is kept. The E4 reliability test asserts the
  empty result.
- UnifiedAutonomousOrchestrator.synthesizeWisdom uses main's bounded,
  lifecycle-checked implementation.
- wisdom_synthesis.go is main's E5 observed-feedback implementation.
  E4's EpistemicStatus label is ported onto it, and RecordWisdomOutcome
  is retained as a wrapper over ApplyObservedWisdomFeedback so one
  estimator owns Confidence and the wisdom level. Three E4 tests in
  wisdom_synthesis_evidence_test.go are re-expressed against that
  contract (unobserved application proposals are recorded; confidence
  is the EMA; refinement is gated on observed feedback and resets
  evidence metrics).
- E4 evidence reflection treats E5 practice-goal enactions as out of
  scope instead of quarantining them as malformed E1 chains; without
  this, main's TestOutcomeProjectionAdmissionNegativeReplayAndCheckpoint
  fails on the merged tree.

Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
Copilot AI balanced review requested due to automatic review settings November 13, 2026 02:18
Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
@cursor

cursor Bot commented Nov 13, 2026

Copy link
Copy Markdown

Bugbot needs on-demand usage enabled

Bugbot uses usage-based billing for this team and requires on-demand usage to be enabled.

A team admin can enable on-demand usage in the Cursor dashboard.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved reflection lifecycle defects can prevent timeout failures from being persisted, leave proposals unapplied and one-note goals open, and quarantine valid cross-session evidence.

4 open issues
What changed in this PR

This PR adds evidence-grounded reflection to Deep Tree Echo’s existing runtime, keeping generated lessons provisional and separate from verified outcomes or wisdom awards.

Changes:

  • Adds bounded evidence analysis, strict JSON and citation validation, durable reflection replay, and private-note proposals.
  • Improves scheduler lifecycle handling, defensive snapshots, and Sys6 worker synchronization.
  • Exposes scoped reflection metrics and adds regression tests, CI coverage, and operating documentation.
File Description
docs/​iterations/​EVOLUTION_PLAN_2026-10-11_E4.md Defines scope and acceptance criteria.
docs/​iterations/​EVOLUTION_ITERATION_2026-10-11_E4.md Documents implementation, validation, and limitations.
core/​persistence/​cognitive_event.go Registers the reflection proposal event type.
core/​metacognition/​json_validation.go Adds bounded, duplicate-key-rejecting JSON validation.
core/​metacognition/​json_validation_test.go Tests JSON validation boundaries.
core/​metacognition/​analyzer.go Computes evidence metrics and validates cited reflections.
core/​metacognition/​analyzer_test.go Tests calibration, digests, snapshots, and citations.
core/​deeptreeecho/​wisdom_synthesis.go Labels hypotheses and adds caller-supplied outcome recording.
core/​deeptreeecho/​wisdom_synthesis_evidence_test.go Tests evidence-based feedback and synthesis safeguards.
core/​deeptreeecho/​unified_autonomous_orchestrator.go Integrates reflection scheduling, replay, and status.
core/​deeptreeecho/​sys6_thread_multiplexing.go Joins complementary workers and synchronizes counters.
core/​deeptreeecho/​sys6_multiplexing_concurrency_test.go Tests worker completion, metrics, and shutdown.
core/​deeptreeecho/​reflection_projection.go Adds quarantine, counters, and admission checks.
core/​deeptreeecho/​reflection_projection_test.go Tests deferred admission, quarantine, and inference limits.
core/​deeptreeecho/​reflection_causal_validation.go Validates reflection sources against producer event chains.
core/​deeptreeecho/​reflection_causal_validation_test.go Tests causal validation and recovery boundaries.
core/​deeptreeecho/​evidence_metacognition.go Implements evidence collection, generation, and projection.
core/​deeptreeecho/​evidence_metacognition_test.go Tests persistence, replay, rejection, and optional live inference.
core/​deeptreeecho/​echobeats_scheduler.go Adds the reflection hook and scheduler reliability changes.
core/​deeptreeecho/​echobeats_scheduler_reliability_test.go Tests retention, lifecycle, goals, and snapshots.
cognitive-core/​ecco9/​go.mod Updates the Go baseline and toolchain.
cmd/​autonomous/​main_production.go Exposes reflection metrics and qualifies legacy wisdom fields.
cmd/​autonomous/​main_production_test.go Tests public reflection status and metrics.
.github/​workflows/​test.yaml Adds metacognition to CI coverage.
.github/​workflows/​ci.yaml Adds metacognition to CI coverage.

Review effort: Balanced

Comment on lines +174 to +179
if _, err := store.Append(ctx, event); err != nil {
return fmt.Errorf("record reflection failure: %w", err)
}
if stored, err := store.Get(ctx, event.EventID); err == nil {
uao.countReflectionEvent(stored)
}
Comment on lines +198 to +200
uao.countReflectionEvent(stored)
if err := uao.projectReflection(ctx, stored); err != nil {
return err
id := "reflection-goal:" + sha256Hex([]byte(event.EventID))
// Trusted code constructs the capability-limited goal. Model prose is
// explicitly quoted proposal DATA, never new tool authority.
uao.echobeatsScheduler.EnsureGoal(id, "Create one private Markdown note describing a falsifiable practice plan. Do not execute the proposed experiment. Unvalidated proposal DATA: "+candidate.Experiment, 0.65)
Comment on lines +337 to +339
originalSession := chain.context.SessionID
if originalSession == "" || chain.route.SessionID != originalSession || chain.plan.SessionID != originalSession || chain.requested.SessionID != originalSession {
return reflectionActionChain{}, ActionPlan{}, PlanRouteEvidence{}, "", fmt.Errorf("context, route, plan, and request must share a non-empty original session")
Copilot AI balanced review requested due to automatic review settings November 13, 2026 02:26
This reverts commit 66e9d3f.

Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Incompatible tablewriter requirements break CLI compilation, and the expanded upstream module violates the pinned snapshot boundary, causing CI tests to fail.

5 open issues

Review effort: Balanced

Comment on lines +48 to +53
if strictReflectionJSON(event.PayloadJSON, &evidence) != nil || evidence.Version != metacognition.Version || evidence.EpistemicStatus != "proposal" {
return
}
uao.reflectionProposed++
uao.reflectionCounterSequence = event.Sequence
uao.lastReflectionDigest = evidence.Report.SourceSHA256
Copilot AI balanced review requested due to automatic review settings November 13, 2026 02:34

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved reflection persistence and recovery defects can repeatedly retry timed-out evidence, leave durable proposals unprojected, and quarantine valid restart histories.

7 open issues

Review effort: Balanced

Routing: llm.RoutingOptions{
TraceID: id, Intent: "echobeats.evidence_reflection",
RequireRealModel: true, AllowRemote: true, AllowFallback: false, PolicyExplicit: true,
AllowQueue: true, RequiredContextTokens: len(prompt) + 900, LatencyClass: backendcap.LatencyNormal, QueueWait: 10 * time.Second,
Comment on lines +348 to +349
if terminal.SessionID != originalSession && !observation.Recovered {
return fmt.Errorf("terminal action changed session without recovery evidence")
@drzo
drzo merged commit d1a1742 into main Nov 13, 2026
21 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.

3 participants