feat(circuit): SynapticCircuit bedrock layer (v0.3) — Beta prior, prediction-error propagation, earned lighthouse floor#12
Conversation
Replaces static W_base(s) constant with mutable Beta-distributed prior. Implements bidirectional prediction-error propagation substrate. - CircuitTypes.swift: Prior, SynapticNode, CircuitEdge, CircuitConstants, ForwardPassResult, BackwardPassResult, CircuitSnapshot, FaultInjectionReport, CalibrationReport - SynapticCircuit.swift: actor with forward/backward pass, connectivity cache, dynamic lighthouse floor, fault injection (snapshot-first) - FaultInjectionSuite.swift: calibration suite producing CalibrationReport ADR-002: W_base -> mutable Beta prior + circuit topology for connectivity_factor ADR-003: lighthouse floor = prior.mean * 0.4 (earned, not granted) ADR-004: prediction error added as dynamic decay amplifier in lambda(s) No existing files modified. SynapseWeightState integration: see docs/adr/INTEGRATION.md. MAESTRO threats documented: T1 (prior poisoning), T2 (error flooding), T3 (lighthouse ossification), T4 (timing side-channel), T5 (schema drift). https://claude.ai/code/session_0193B19zr8PsbvJMphKxufw4
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (8)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)❌ Error creating Unit Test PR.
Comment |
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
✅ Created PR with unit tests: #13 |
…dule conflict SynapseCore.swift:183 defines `public struct Prior` (simple Beta wrapper, serialized to disk). CircuitTypes.swift originally defined a second `public struct Prior` (the richer SynapticPrior). Both land in the SynapseCore module — duplicate type definition, build failure. Fix: rename the circuit-layer type to SynapticPrior throughout CircuitTypes.swift. SynapseCore.Prior is untouched — it is part of the on-disk config.json schema. Also update CLAUDE.md with full architecture map, PR status, sprint backlog, and known issues from the current session. https://claude.ai/code/session_0193B19zr8PsbvJMphKxufw4
Mutating `nodes[id] = node` while the for-in loop iterates over `nodes` triggers a Law of Exclusivity violation in debug mode (simultaneous read and write access to the same dictionary). Fix by taking a value-type snapshot before the loop; writes go to the live `nodes` dict as before, but the iterator walks the immutable snapshot. https://claude.ai/code/session_0193B19zr8PsbvJMphKxufw4
…lVector RegionModel.swift (ContextSynapseApp) re-declared public func canonicalVector(for:scale:) as an extension on SynapseCore while the identical method already exists inside the SynapseCore class body at SynapseCore.swift:579. Swift produces an invalid redeclaration error when building ContextSynapseApp, causing swift build -c release to fail for every PR branched from main — the systemic CI failure. The method is never called from ContextSynapseApp; the canonical definition in SynapseCore.swift is unaffected. https://claude.ai/code/session_0193B19zr8PsbvJMphKxufw4
|
Note Unit test generation is a public access feature. Expect some limitations and changes as we gather feedback and continue to improve it. Generating unit tests... This may take up to 20 minutes. |
|
No files have been changed in this PR. Unable to generate unit tests. |
Summary
Replaces the static
W_base(s)constant in the decay formula with a mutable Beta-distributed prior, and introduces the bidirectional prediction-error propagation substrate the v0.3 decay layer was missing.Sources/SynapseCore/Circuit/CircuitTypes.swift—Prior,SynapticNode,CircuitEdge,CircuitConstants, plus all Sendable output value types (ForwardPassResult,BackwardPassResult,CircuitSnapshot,FaultInjectionReport,CalibrationReport).Sources/SynapseCore/Circuit/SynapticCircuit.swift— Swift actor with forward/backward pass, connectivity cache, dynamic lighthouse floor, snapshot-first fault injection. Ordering enforced internally vialastForwardPassNumber.Sources/SynapseCore/FaultInjection/FaultInjectionSuite.swift— calibration suite producing empirical recommendations forROT_LAMBDA_AMPLIFIERandROT_CAUTERIZE_THRESHOLD.Architecture Decision Records
W_base(s)→ mutable Beta prior.connectivity_factor(s)derived from edge topology. Prediction error becomes a first-class learning signal.prior.mean × 0.4. The floor is earned, not granted. Lighthouse misdesignation becomes self-correcting.λ(s, t)as a dynamic decay amplifier alongside (not replacing) rot scoring. Two orthogonal failure modes captured independently.Full ADRs in
docs/adr/. Integration guide forSynapseWeightStateconsumption indocs/adr/INTEGRATION.md.Scope discipline
No existing files modified.
SynapseCore.swift,SynapseWeightState.swift,RavenRenderer.swift, the CLI, the SwiftUI app — all untouched. This PR is bedrock only; the consumer-side wiring (replacingW_baseinSynapseWeightState.decayWeight) is the next PR.Known threats (MAESTRO)
Documented in ADR-002 risk table:
FaultInjectionSuite.auditLighthousesschemaVersionHashinCircuitSnapshotOut of scope for this PR
SynapseWeightStateintegration — separate PR, integration recipe indocs/adr/INTEGRATION.mdSynapseManagerbackward-pass wiring — v0.4CircuitSnapshotto disk — needed before v1.0; not blocking the bedrockPackage.swiftbump toswift-tools-version:6.0for strict concurrency — recommended follow-up, code is already actor-isolated andSendable-compliantTest plan
macos-15(Swift 5.8+ toolchain)BayesianConvergenceTestscontinue to pass (no changes to consumed surfaces)SynapticCircuit, register a few nodes, runforwardPass()→backwardPass(observations:)→ confirmBackwardPassResult.predictionErrorsreflects |predicted − observed|FaultInjectionSuite.runFullSuite()against a small circuit and confirmCalibrationReport.formattedSummaryproduces a sensible recommendationBedrock unit tests will follow in a separate PR — keeping this one to net-new files and zero modifications for review clarity.
https://claude.ai/code/session_0193B19zr8PsbvJMphKxufw4
Generated by Claude Code