Repository navigation
E4: evidence-grounded reflection and wisdom cultivation - #35
Conversation
Bugbot is paused — on-demand spend limit reachedBugbot 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. |
|
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>
Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
Bugbot needs on-demand usage enabledBugbot 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. |
There was a problem hiding this comment.
🟡 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
| 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) | ||
| } |
| 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) |
| 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") |
This reverts commit 66e9d3f. Co-authored-by: drzo <15202748+drzo@users.noreply.github.com>
| 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 |
There was a problem hiding this comment.
🟡 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
Avoid double-counting the output token budget · New Validate resumed actions across session boundaries · New Only consume reflection digests after successful validation Allow validated artifact provenance across session restarts Complete one-note goals after their single action Retry pending proposals before skipping consumed evidence Persist reflection timeouts with a separate bounded context
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, |
| if terminal.SessionID != originalSession && !observation.Recovered { | ||
| return fmt.Errorf("terminal action changed session without recovery evidence") |

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@1b22401ee8842fd1aa2769b688d588cd9f1f9ce9are verified byte-identical in the existing local core integration. The implementation retains one canonical production scheduler/provider/ledger and the reviewedadapted_observedbridge instead of activating conflicting historical prototypes.Implemented
reflection.proposedat step 8; uncertainty-bearing hypotheses; durable replay/counters/quarantine; one-call pivot; deferred admission while prior practice remains openFinal 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 indocs/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.
RecordWisdomOutcomeremains 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.