Caliper is an adaptive decision and measurement layer for autonomous work.
This repository contains the v1 implementation scaffold and core substrate, designed to run:
- embedded (same process / same machine),
- as a local service,
- and as a shared service.
apps/runnable entry points (api,worker,cli)packages/modular domain/runtime packages- default path: core/adapters/policies/storage/reports/events/sdk used by embedded + service flows
- experimental seams are namespaced (for example
caliper_adapters.experimental.*) and opt-in
examples/workflow, web, and email demosdocs/README.mdconcise docs index (architecture, operations, demos, autotune)docs/archive/execution-pack/frozen execution/build-history packdocs/adr/architecture decision recordstests/unit, integration, property, replay, and load tests
make setup
make precommit-install
make lint
make typecheck
make test
make run-embedded
make seed-demo-dataFor full machine setup + hardening runbooks, use:
docs/archive/execution-pack/PACKAGING_INSTALL_FLOW.mddocs/archive/execution-pack/BACKUP_RESTORE_RUNBOOK.md
Install hooks once per clone:
make precommit-installRun hooks against staged changes:
make precommit-runRun hooks against the entire repository:
make precommit-run-allHook policy:
ruff check --fix+ruff formaton Python files- hygiene checks (YAML/JSON/merge-conflicts/whitespace)
- gitleaks secret scan
- pre-push checks for
mypyand TypeScript typecheck
The command surface is intentionally stable for automation:
make setupmake lintmake formatmake typecheckmake testmake test-unitmake test-integrationmake test-propertymake demo-workflowmake demo-webmake demo-emailmake run-landing-page-demomake run-email-demomake run-embeddedmake run-servicemake run-workermake seed-demo-datamake backup-localmake restore-local
Caliper uses profile-driven config:
embedded: SQLite + local artifactsservice: Postgres + API + workershared: service profile + auth/workspace scoping
Use the deployment examples in deploy/env/:
deploy/env/.env.embedded.exampledeploy/env/.env.service.exampledeploy/env/.env.shared.example
Set CALIPER_PROFILE and related env vars to switch mode. Shared mode enables auth by default and supports CALIPER_SHARED_API_TOKEN for basic secret-backed API access.
Top-level scripts for automated demo orchestration:
./run_landing_page_demo --topic "..." --variant-count 5 --mode dry_run./run_landing_page_demo --topic "..." --variant-count 5 --mode serve_only --backend embedded --observe-seconds 180./run_landing_page_demo --topic "..." --variant-count 5 --mode serve_and_simulate --backend embedded./run_landing_page_demo --topic "..." --variant-count 5 --mode live(alias forserve_and_simulate)./run_landing_page_demo --topic "..." --variant-count 5 --mode serve_only --open-tunnel./run_email_demo --topic "..." --recipients "a@example.com,b@example.com" --variant-count 5 --mode dry_run --backend embedded./run_email_demo --topic "..." --recipients "a@example.com,b@example.com" --variant-count 5 --mode dry_run --backend service --api-url http://127.0.0.1:8000./run_email_demo --topic "..." --recipients "a@example.com,b@example.com" --variant-count 5 --mode live --backend embedded./run_email_demo --topic "..." --recipients "a@example.com,b@example.com" --variant-count 5 --mode dry_run --open-tunnelscripts/run_landing_demo_with_tunnel.sh/scripts/run_email_demo_with_tunnel.shone-command tunnel helpers
Mode semantics (current):
- Landing
dry_run: synthetic in-process simulation. - Landing
serve_only: real FastAPI demo server + tracked routes, no synthetic traffic driver. - Landing
serve_and_simulate: real FastAPI demo server + synthetic visitor driver against real endpoints. - Landing
live: alias forserve_and_simulate. - Landing supports
--backend embedded|servicefor the same orchestrator flow. - Landing served modes support
--public-base-url https://...or--open-tunnelfor externally reachable links. - Landing served modes inject a browser tracker helper with retry queue persistence, beacon/keepalive fallback, delegated click tracking, and auto visible-time (
time_spent) emission. - Landing served modes also inject an operator panel (
apps/demo_web/static/operator_panel.js) with:- current visitor/decision/arm context,
- explicit
Reset identityandForce new visitorcontrols, - backend/telemetry mode + tracking endpoint health status.
- Operator actions round-trip through
force_new_visitor=1andoperator_action=...query params; landing exposure metadata records these fields for replay/audit. - Tracker helpers can be toggled per-request with
browser_tracker=0,track_time_spent=0, andtrack_clicks=0query params. - Email supports
--backend embedded|service. - Email supports
--public-base-url https://...or--open-tunnelfor canonical tracked/report URLs. - Email starts a tracking server (
apps.demo_email) and wires per-recipient links to tracked routes:/email/{job_id}/click/email/{job_id}/convert/email/{job_id}/reply
- Email
dry_run: synthetic provider + synthetic tracked-route driver (click/conversion/reply). - Email
live: real Gmail SMTP send path only; command fails fast if Gmail credentials are missing.- By default,
livedoes not inject synthetic tracked events. - Use
--simulate-tracked-eventsto force synthetic route hits inlivemode.
- By default,
- Reply signal first-step ingest command:
uv run python scripts/ingest_email_reply_signal.py ...
Each run writes report artifacts plus a machine-readable winner_summary.json manifest under reports/landing_page_demo/<mode>/ or reports/email_demo/<mode>/.
Both manifests are canonicalized with backend/mode/provider semantics, URLs, measurement metadata, metrics, and artifact paths (email adds tracked-route + reply-ingest details).
Landing serve-and-simulate manifests also include browser-tracker telemetry summaries (event counts, visible time totals, and click metadata samples).
Tunnel safety notes:
- Treat quick tunnels as temporary public exposure of your local demo endpoints.
- Use demo/synthetic data only while a tunnel is active.
- End the run (or press
Ctrl-C) immediately after walkthroughs to close server + tunnel.
Live walkthrough script (operator UX):
- Start served mode (
serve_onlyfor real traffic,live/serve_and_simulatefor synthetic assist). - Open
demo_urland point out Operator Panel context: visitor id, decision id, arm id, backend mode, telemetry mode. - Click Force new visitor and explain that Caliper evaluates a fresh unit; mention
operator_action=force_new_visitorappears in tracked render metadata. - Click Reset identity to clear cookies + re-run assignment as a brand-new visitor; mention
operator_action=reset_identity. - Optional: toggle
browser_tracker=0in URL to demonstrate telemetry mode differences. - End by opening
report_urland correlating observed operator actions with report/manifest fields.