Wave-8 close-the-gaps move 3. The five-lens cross-talk audit
(Phillip / Rafie / Bloom / Hyper-Agent / Priscilla) named the same
on-ramp gap from five different vocabularies: *"100 crates, one
end-to-end example."* This commit closes it.
Six runnable starter cascades, each ≤ 120 LOC, one per use case
the audits surfaced. Every example builds with `cargo run -p
jouleclaw-stack --example <name>` and produces a meaningful output
out of the box.
## The six examples
minimal_cache_only.rs The smallest cascade walk. Ask the
same question twice, watch the L0
cache serve the repeat at floor
energy. (Phillip: text-is-state.)
rag_with_retrieval.rs Seeded local index → retrieve →
enrich → rerank → read pipeline,
with per-stage joule trace. (Bloom:
the verifiable zone in action.)
comprehend_demo.rs `Stack::comprehend` against a
seeded corpus, with HeuristicClassifier
installed. Prints passages,
extracted answer, intent verdict,
and the verifiable-zone invariant.
(Priscilla: *understand before you
generate*.)
agent_with_skill_induction.rs Register a Skill with a template
matcher + Format procedure, watch
the cascade resolve a whole query
class at L0.5 — nanojoules, no
model invocation. (Phillip:
agent-ready APIs.)
save_memory_and_promote.rs Demonstrates Hyper-Agent's three
modes of memory on JouleClaw's
primitives: manual save_memory,
plus an FnPromotionListener
capturing a NotifyPromotedFact
event when a verified compartment
answer is promoted. (Hyper-Agent:
three modes of memory.)
ledger_breakdown.rs Constructs a 7-receipt synthetic
workload over jouleclaw-ledger,
prints a CostSummary by tier /
tool / model / intent. The output
reproduces a Priscilla-style 67/2-
ish breakdown on a controlled
fixture. (Rafie: breakdown at the
top.)
## AGENTS.md companion
`examples/AGENTS.md` indexes the six with a one-line "what it shows"
and the audit lens each serves. The doctrine in one line:
*Inference is the last resort, not the entry point.* (SPEC §1.1)
Discovered automatically by `jouleclaw-agents-md` via the hierarchical
walk; an operator who drops their own AGENTS.md alongside picks up
the starter notes without configuration.
## Test infrastructure
`[dev-dependencies]` in `jouleclaw-stack/Cargo.toml` extended with
`jouleclaw-prov`, `jouleclaw-energy`, `jouleclaw-ledger`,
`jouleclaw-local-index`, `jouleclaw-skill` — needed by examples and
documented as such ("Direct deps the starter examples reach for").
These do not affect the library surface.
All six examples smoke-tested:
minimal_cache_only first ask L3 / second ask L0 (cache hit)
rag_with_retrieval extracts "Paris" from seeded index
comprehend_demo highest tier = L2.5 (invariant), intent
tagged as comprehension (80% confidence)
agent_with_skill_induction three countries all resolve at L0.5
(~40 nanojoules each)
save_memory_and_promote manual capture + listener fires once
ledger_breakdown 7 receipts → 71.4% / 14.3% comprehension /
generation (close to Priscilla's 67% / 2%)
Workspace regression: 0 failures.
55 lines
1.7 KiB
Rust
55 lines
1.7 KiB
Rust
//! `minimal_cache_only` — the smallest runnable JouleClaw cascade.
|
|
//!
|
|
//! Boots a default stack, asks one question twice, and shows that the
|
|
//! L0 cache served the second hit at floor energy. The Bloom-tier
|
|
//! framing's *Remember* category in action.
|
|
//!
|
|
//! Run with:
|
|
//! cargo run -p jouleclaw-stack --example minimal_cache_only
|
|
|
|
use jouleclaw_cascade::tier::Runtime;
|
|
use jouleclaw_cascade::types::{
|
|
ContextRef, JouleBudget, QualityFloor, Query, QueryInput,
|
|
};
|
|
use jouleclaw_stack::JouleClawStack;
|
|
|
|
fn make_query(text: &str) -> Query {
|
|
Query {
|
|
input: QueryInput::Text(text.to_string()),
|
|
budget: JouleBudget::expensive(),
|
|
quality: QualityFloor::any(),
|
|
context: ContextRef::fresh(),
|
|
deadline: None,
|
|
}
|
|
}
|
|
|
|
fn main() {
|
|
let mut stack = JouleClawStack::with_defaults();
|
|
let question = "what is the magic word?";
|
|
|
|
println!("first ask → walks the full cascade");
|
|
let r1 = first_ask(&mut stack.runtime, question);
|
|
|
|
println!("second ask → should be a cache hit");
|
|
let r2 = first_ask(&mut stack.runtime, question);
|
|
|
|
println!("\nresults:");
|
|
println!(" ask 1: tier={} joules={:.6}", r1.tier, r1.joules);
|
|
println!(" ask 2: tier={} joules={:.6}", r2.tier, r2.joules);
|
|
if r2.joules <= r1.joules {
|
|
println!("\n✓ cascade preferred the cheaper tier on repeat.");
|
|
}
|
|
}
|
|
|
|
struct Resolved {
|
|
tier: String,
|
|
joules: f64,
|
|
}
|
|
|
|
fn first_ask(runtime: &mut Runtime, question: &str) -> Resolved {
|
|
let answer = runtime.answer(make_query(question)).expect("cascade walks");
|
|
Resolved {
|
|
tier: answer.tier_used.wire_tag().to_string(),
|
|
joules: answer.joules_spent,
|
|
}
|
|
}
|