Deploy Poimen Memory K8s cluster with ArgoCD tracking (M2.2, M3.5-M3.7)
ci / markdown (push) Waiting to run
ci / markdown (push) Waiting to run
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|---|---|
|
||||
| Phase | M1 — Gated loop at L1 |
|
||||
| Size | L — 3+ days |
|
||||
| Status | ⬜ Not started |
|
||||
| Status | ✅ Done |
|
||||
| Flags | — |
|
||||
| Spec | inlined below |
|
||||
| Blocks | M1.4 |
|
||||
@@ -14,6 +14,44 @@
|
||||
The recurrence itself: `U_t, M̂_t, E_t = φθ(Q, C_t, M_{t-1})`, with the level as a
|
||||
parameter so L2 reuses it unchanged.
|
||||
|
||||
## Files
|
||||
|
||||
| Action | Path |
|
||||
|---|---|
|
||||
| Create | `crates/mem-core/src/gated_loop.rs` — `run_loop()`, `LoopConfig`, `LoopEvent`, `RunOutcome` |
|
||||
| Modify | `crates/mem-core/src/lib.rs` — add `pub mod gated_loop;` and re-exports |
|
||||
| Create | `tests/it_gated_loop.rs` — integration tests (workspace root, 10 assertions) |
|
||||
|
||||
## Dependencies
|
||||
|
||||
| Crate | Where | Already present? |
|
||||
|---|---|---|
|
||||
| `async-trait` | `crates/mem-core/Cargo.toml` | ❌ add — for `LlmClient` trait |
|
||||
|
||||
Or use `impl Future` return types and avoid the dependency.
|
||||
|
||||
## Existing code to reuse
|
||||
|
||||
- `Chunk`, `Level`, `Sha256Hash` from `domain.rs` — input/output types
|
||||
- `Query` from `query.rs` (M1.2) — the standing question
|
||||
- `PromptBuilder` from `prompt.rs` (M1.3) — assemble the prompt per turn
|
||||
- `parse_gate_response` from `gate_parser.rs` (M1.4) — parse LLM output
|
||||
- `ChatClient` from `mem-llm/src/chat.rs` (M1.1) — call the LLM
|
||||
- `TokenCounter` from `mem-chunk/src/token_counter.rs` — measure candidate memory tokens
|
||||
|
||||
## Dependency injection
|
||||
|
||||
The loop needs an LLM client, but tests must use a scripted fake. Define a trait:
|
||||
```rust
|
||||
// in gated_loop.rs
|
||||
pub trait LlmClient: Send + Sync {
|
||||
fn complete(&self, system: &str, user: &str, max_tokens: usize)
|
||||
-> impl std::future::Future<Output = anyhow::Result<mem_llm::Completion>> + Send;
|
||||
}
|
||||
```
|
||||
`ChatClient` implements it. Tests use a `ScriptedClient` that returns canned
|
||||
responses indexed by turn number.
|
||||
|
||||
## Facts (inlined — no spec read needed)
|
||||
|
||||
Paper Algorithm 1, transcribed:
|
||||
@@ -97,7 +135,7 @@ the whole loop runs with no network and fully determined gate sequences.
|
||||
10. `a10_level_is_a_parameter` — run the identical script at L1 and L2; assert the
|
||||
only difference in emitted events is the `level` field.
|
||||
|
||||
**Command:** `cargo test -p mem-core gated_loop`
|
||||
**Command:** `cargo test --test it_gated_loop`
|
||||
|
||||
**False pass:**
|
||||
- Testing with a fake that always returns `yes`. Every assertion about the retain
|
||||
|
||||
Reference in New Issue
Block a user