open-standards/jouleclaw/jouleclaw-rs/crates/jouleclaw-stack/examples
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Transaction Science 12a8a673b7 jouleclaw-stack: seeded_cascade_with_adapters example
End-to-end composition example for the adapter sweep. Walks a
query through the full cascade using crates from f168037 /
b8367d0 / 7328d8c / 03e7571 / 03c063c / 6594a54 — no API keys,
no network, no model-weight downloads required.

Walk shape:
  L3.5 fresh    ArxivProvider.search(query, 5)
  L3.5 fetch    JinaReader.read(top_hit.url)
  L2 embed      OpenAiEmbedBackend.embed_batch([query, ...docs])
  L2.5 rerank   CohereRerankBackend.rerank(query, docs, top=2)
  L3 LLM        OllamaBackend.complete(prompt with top doc + query)
  receipt       prints joule + token accounting

Composition truths the example demonstrates:

  - Every adapter shipped in the sweep accepts a caller-injected
    transport. The example wires deterministic mock transports
    so the binary compiles + runs offline; swapping in
    reqwest::blocking wrappers turns it into a real production
    walk with no other changes.
  - The Transport trait (GET-only, no headers) handles the
    free-tier providers; the HttpTransportExt trait (POST + auth
    + headers) handles the paid-tier providers. Both are
    demonstrated.
  - jouleclaw-llm's sync HttpTransport pattern works identically
    across OllamaBackend / OpenAiCompatibleBackend / Anthropic /
    Gemini — consumer picks at runtime.
  - jouleclaw-embed-api and jouleclaw-rerank-api share the same
    bearer-token transport shape, and both produce the typed
    shapes (Vec<f32> for embed; Vec<(usize, f32)> for rerank)
    the downstream cascade tiers consume.
  - Joules + tokens are first-class fields in the receipt; the
    example prints joules/token as a single-number summary.

Output (deterministic):

  Q: How does Tokio's task scheduler work?

  L3.5 fresh (arxiv) — 3 hits
    [0] Work-Stealing Task Scheduling …
    [1] Parking Strategies for Idle Workers …
    [2] Cooperative Scheduling and Fairness …
  L3.5 fetch (jina reader) — fetched 136 bytes …
  L2 embed (openai-shape) — 4 vectors of dim 4
  L2.5 rerank (cohere v3) — top 3 …
  L3 LLM (ollama qwen2.5:7b) — 240 prompt tokens, 38 output tokens

  ANSWER: Tokio's scheduler is work-stealing with M:N threading. …
  RECEIPT: 0.012 J · 278 tokens · 0.043 mJ/token

Dev-deps added to jouleclaw-stack:
  jouleclaw-fresh        (the providers + Transport / HttpTransportExt)
  jouleclaw-embed-api    (OpenAiEmbedBackend etc)
  jouleclaw-rerank-api   (CohereRerankBackend etc)
  async-trait, chrono    (for the mock Transport impls)

Run: cargo run -p jouleclaw-stack --example seeded_cascade_with_adapters

Co-Authored-By: Claude Opus 4.7 <[email protected]>
2026-06-06 11:28:54 -04:00
..
agent_with_skill_induction.rs jouleclaw-stack/examples: 6 starter cascades — the on-ramp the audit asked for 2026-06-01 02:39:49 -04:00
AGENTS.md jouleclaw: cross-standard composition demo (JouleClaw → JCR-1 → OpenPay) 2026-06-04 03:58:20 -04:00
comprehend_demo.rs jouleclaw-stack/examples: 6 starter cascades — the on-ramp the audit asked for 2026-06-01 02:39:49 -04:00
full_cascade_with_triangle.rs jouleclaw: end-to-end demo binary — cascade + triangle + JCR-1 2026-06-04 03:19:31 -04:00
ledger_breakdown.rs jouleclaw-stack/examples: 6 starter cascades — the on-ramp the audit asked for 2026-06-01 02:39:49 -04:00
minimal_cache_only.rs jouleclaw-stack/examples: 6 starter cascades — the on-ramp the audit asked for 2026-06-01 02:39:49 -04:00
openpay_per_joule_billing.rs jouleclaw: cross-standard composition demo (JouleClaw → JCR-1 → OpenPay) 2026-06-04 03:58:20 -04:00
rag_with_retrieval.rs jouleclaw-stack/examples: 6 starter cascades — the on-ramp the audit asked for 2026-06-01 02:39:49 -04:00
save_memory_and_promote.rs jouleclaw-stack/examples: 6 starter cascades — the on-ramp the audit asked for 2026-06-01 02:39:49 -04:00
seeded_cascade_with_adapters.rs jouleclaw-stack: seeded_cascade_with_adapters example 2026-06-06 11:28:54 -04:00
wave46_recall_fuzz_verified.rs jouleclaw: wave-46 — ingest from today's SOTA research 2026-06-05 03:56:59 -04:00
wave47_streaming_pipeline.rs jouleclaw: wave-47 — streaming-cascade substrate 2026-06-05 04:12:16 -04:00
wave48_ui_streaming.rs jouleclaw: wave-48 — UI-output ladder + per-rung Oracles + JCR-1 ui-output/1 2026-06-05 04:39:03 -04:00
wave49_full_stack.rs jouleclaw: wave-49 — typed cross-standards binding (JouleClaw + Sandbox + Joule-Code) 2026-06-05 05:09:10 -04:00
wave50_coding_stream.rs jouleclaw: wave-50 — streaming coding ops (jouleclaw-stream × joule-code) 2026-06-05 05:27:09 -04:00
wave51_streaming_trace_binding.rs jouleclaw: wave-51 — streaming-trace binding (multi-window cross-standards) 2026-06-05 08:50:07 -04:00
wave54_event_log_replay.rs jouleclaw: wave-54 — event-sourced agent substrate (ActiveGraph ingest) 2026-06-05 13:01:12 -04:00