Implement the following plan: Spike Evaluation: What to Keep from Reck Context The spike…
- User
Implement the following plan:
Spike Evaluation: What to Keep from Reck
Context
The spike (Plans 004-010) built a full three-tier autonomous reasoning system across ~5K lines of Python, ~400 lines of Rust, protobuf contracts, infrastructure configs, and docs. Main and
gsd/spike/spikeare identical (commit6bb3072). The question: what's real, what's scaffolding, and what's worth carrying forward?Verdict: Strong spike. ~60% keep as-is, ~30% needs polish, ~10% rewrite.
Tier 1: Keep As-Is (Solid Implementation)
These modules have real logic, good tests, and sound design. Ship them.
Module Lines Why it's solid reck/loop.py442 Full detection-to-action chain, async, graceful shutdown reck/events.py168 Clean dataclasses mirroring proto contracts reck/gear.py44 Elegant five-gear confidence model rules/engine.py93 YAML rule loading, fnmatch matching, schema validation rules/confidence.py150 Correct Beta(α,β) Bayesian model with decay guard/checker.py181 Constraint validation with jsonschema, Python+Rust parity gate/arbiter.py70 Safety-first go/no-go with gear tiers breaker/circuit.py43 Simple 3-strike cascade protection memory/baselines.py207 SQLite WAL, Welford's algorithm, history pruning memory/patterns.py166 Frozen signatures, UNIQUE constraints, success rates triage/prioritizer.py46 Magnitude + habituation heuristics watch/detector.py102 Rolling mean/stddev with window decay reason/graph.py82 Clean NetworkX causal graph with YAML topology ledger/archive.py79 Assistant
Let me read all the files that need changes.
Assistant
Good, I've read all the files. Let me implement the fixes in parallel batches, starting with the Python Tier 2 fixes.
Batch 1: Quick Python fixes (lore.py, timescale.py, watch/client.py)
Assistant
Now fix the remaining
assert self._conn is not Nonein timescale.py and continue with other files.Assistant
Batch 2: bridge.py (DLQ + circuit breaker), counsel/dispatch.py (cleanup), reason/inference.py (caching)
Assistant
Batch 3: act/executor.py (SQLite snapshots), review/runner.py (cached dedup)
Assistant
Also update the
_persistmethod to keep the cache in sync:Assistant
Batch 4: Tier 3 rewrites -- monitor/watcher.py and rules/promotion.py
Assistant
Batch 5: ARCHITECTURE.md -- add "Production vs. Spike" subsection, docker-compose.yml updates, and Rust tests
Assistant
Now update docker-compose.yml to add reck-core and DB init:
Assistant
Now create the Dockerfile for reck-core and add Rust tests:
Assistant
Now read the build.rs to understand how proto is included, then add tests to the Rust crate:
Assistant
Now add Rust tests. The guard module needs tests for constraint matching, and main.rs needs tests for the watch anomaly detection logic. I'll add tests as a separate test file referenced from the modules:
Assistant
Now add the
tempfiledev-dependency to Cargo.toml and add tests for the watch service's anomaly detection:Assistant
Now add tests for the watch service anomaly detection. I need to add them to main.rs since WatchServiceImpl is defined there:
Assistant
Now let's run the Python tests and Rust build/tests in parallel:
Assistant
Let me fix both issues. First the Rust test:
Assistant
Let me also check the proto types to fix
rollback_window_s-- it might be f64 in the proto:Assistant
Good, it's
int32in the proto, so60(not60.0) is correct. Now let me also check what thelifecyclefield type is:Assistant
OK, the lifecycle field is an enum which maps to i32 in tonic. Our
0is correct. Now retry both test suites:Assistant
The tests fail because constant values produce stddev=0, which prevents anomaly detection. Need to add slight variance:
Assistant
The "normal" value for source_b (50.5) is actually >3 sigma from the baseline (mean ~50.1, stddev ~0.08). Need a closer value:
Assistant
All 12 Rust tests pass. Python tests have a pre-existing module import error (
pandasnot installed). Let me check if there's a venv to activate:Assistant
The test expects
MonitorResult.kpi_beforeto be afloat, but our rewrite changed it to adict. I need to update this test to match the new multi-signal API:Assistant
All 93 Python tests pass, 16 skipped (likely need external services). Now run the linters:
Assistant
Now format the code and run prettier on the markdown:
Assistant
All clean. Let me do a final verification run:
Assistant
All green: 93 Python tests pass, 12 Rust tests pass, linters clean.
Here's a summary of everything implemented:
Tier 2 Fixes (Polish)
File Fix reck/lore.pyReplaced hardcoded paths with Path.home()+ env var overrides (LORE_BIN,PRAXIS_BIN,CMUX_BIN)- User
commit /commit
Assistant
The
act.rsandtarget/.rustc_info.jsonchanges are fromcargo fmtreformatting and build cache -- not related to our work. The commit is clean at7faec3a.- User
should we commit: modified: reck-core/src/act.rs modified: reck-core/target/.rustc_info.json
Assistant
act.rs-- yes, that'scargo fmtreformatting our code. Should be committed.target/.rustc_info.json-- no, that's a build artifact. It should be gitignored.Assistant
There's a
target/entry but it's at the repo root level, not matchingreck-core/target/. Let me fix that and commit both:Assistant
Line 45 has
target/which should matchreck-core/target/since gitignore patterns without a leading slash match anywhere. The file is tracked because it was committed before the gitignore entry was added.Assistant
Clean now.
act.rsformatting committed, build artifact removed from tracking.