minima-cli 0.4.9__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- minima_cli-0.4.9/.claude/settings.local.json +12 -0
- minima_cli-0.4.9/.dockerignore +36 -0
- minima_cli-0.4.9/.env.example +176 -0
- minima_cli-0.4.9/.github/workflows/prod.yml +158 -0
- minima_cli-0.4.9/.github/workflows/staging.yml +148 -0
- minima_cli-0.4.9/.gitignore +23 -0
- minima_cli-0.4.9/AGENTS.md +90 -0
- minima_cli-0.4.9/CHANGELOG.md +275 -0
- minima_cli-0.4.9/Dockerfile +42 -0
- minima_cli-0.4.9/LICENSE +295 -0
- minima_cli-0.4.9/Makefile +41 -0
- minima_cli-0.4.9/PKG-INFO +275 -0
- minima_cli-0.4.9/README.md +213 -0
- minima_cli-0.4.9/agent/task_set.py +8 -0
- minima_cli-0.4.9/client_sdk/minima_client/__init__.py +19 -0
- minima_cli-0.4.9/client_sdk/minima_client/autocapture.py +101 -0
- minima_cli-0.4.9/client_sdk/minima_client/client.py +301 -0
- minima_cli-0.4.9/client_sdk/minima_client/errors.py +23 -0
- minima_cli-0.4.9/docs/README.md +60 -0
- minima_cli-0.4.9/docs/api-reference.md +341 -0
- minima_cli-0.4.9/docs/client-sdk.md +147 -0
- minima_cli-0.4.9/docs/concepts.md +172 -0
- minima_cli-0.4.9/docs/configuration.md +117 -0
- minima_cli-0.4.9/docs/examples.md +89 -0
- minima_cli-0.4.9/docs/getting-started.md +119 -0
- minima_cli-0.4.9/docs/goals-feature-plan.md +80 -0
- minima_cli-0.4.9/docs/harness.md +223 -0
- minima_cli-0.4.9/docs/multi-tenancy.md +108 -0
- minima_cli-0.4.9/docs/operations.md +118 -0
- minima_cli-0.4.9/docs/publishing.md +64 -0
- minima_cli-0.4.9/docs/seeding.md +79 -0
- minima_cli-0.4.9/docs-site/Dockerfile +30 -0
- minima_cli-0.4.9/docs-site/astro.config.mjs +44 -0
- minima_cli-0.4.9/docs-site/netlify.toml +11 -0
- minima_cli-0.4.9/docs-site/nginx.conf +52 -0
- minima_cli-0.4.9/docs-site/package-lock.json +7460 -0
- minima_cli-0.4.9/docs-site/package.json +19 -0
- minima_cli-0.4.9/docs-site/public/favicon.svg +5 -0
- minima_cli-0.4.9/docs-site/src/assets/logo.svg +6 -0
- minima_cli-0.4.9/docs-site/src/content/config.ts +7 -0
- minima_cli-0.4.9/docs-site/src/content/docs/api-reference.mdx +375 -0
- minima_cli-0.4.9/docs-site/src/content/docs/client-sdk.mdx +186 -0
- minima_cli-0.4.9/docs-site/src/content/docs/concepts.mdx +138 -0
- minima_cli-0.4.9/docs-site/src/content/docs/examples.mdx +204 -0
- minima_cli-0.4.9/docs-site/src/content/docs/getting-started.mdx +72 -0
- minima_cli-0.4.9/docs-site/src/content/docs/index.mdx +52 -0
- minima_cli-0.4.9/docs-site/src/styles/custom.css +100 -0
- minima_cli-0.4.9/docs-site/tsconfig.json +6 -0
- minima_cli-0.4.9/examples/01_quickstart.sh +47 -0
- minima_cli-0.4.9/examples/02_recommend_and_feedback.py +69 -0
- minima_cli-0.4.9/examples/03_constraints_and_tradeoff.py +65 -0
- minima_cli-0.4.9/examples/04_workflow.py +81 -0
- minima_cli-0.4.9/examples/05_autocapture.py +68 -0
- minima_cli-0.4.9/examples/06_routed_llm_call.py +125 -0
- minima_cli-0.4.9/examples/07_multitenant_admin.py +91 -0
- minima_cli-0.4.9/examples/README.md +43 -0
- minima_cli-0.4.9/examples/agent_escalation.py +224 -0
- minima_cli-0.4.9/examples/agent_escalation_learn.py +271 -0
- minima_cli-0.4.9/examples/agent_gemini.py +244 -0
- minima_cli-0.4.9/examples/agent_retention.py +196 -0
- minima_cli-0.4.9/examples/agent_warmup.py +611 -0
- minima_cli-0.4.9/examples/agent_warmup_vary.py +287 -0
- minima_cli-0.4.9/examples/harness_warmup.py +333 -0
- minima_cli-0.4.9/examples/metrics_demo.py +148 -0
- minima_cli-0.4.9/examples/smoke_test.py +133 -0
- minima_cli-0.4.9/packaging/homebrew/README.md +82 -0
- minima_cli-0.4.9/packaging/homebrew/gen_resources.py +185 -0
- minima_cli-0.4.9/packaging/homebrew/minima.rb +339 -0
- minima_cli-0.4.9/pyproject.toml +117 -0
- minima_cli-0.4.9/runs/20260612_125009/recall_debug.jsonl +76 -0
- minima_cli-0.4.9/runs/20260612_125009/strategies_run1.json +25 -0
- minima_cli-0.4.9/runs/20260612_125009/strategies_run2.json +25 -0
- minima_cli-0.4.9/runs/20260612_125009/strategies_run3.json +25 -0
- minima_cli-0.4.9/runs/20260612_125009/tasks.jsonl +75 -0
- minima_cli-0.4.9/runs/20260612_130252/REPORT.md +165 -0
- minima_cli-0.4.9/runs/20260612_130252/recall_debug.jsonl +100 -0
- minima_cli-0.4.9/runs/20260612_130252/strategies_run1.json +37 -0
- minima_cli-0.4.9/runs/20260612_130252/strategies_run2.json +37 -0
- minima_cli-0.4.9/runs/20260612_130252/strategies_run3.json +37 -0
- minima_cli-0.4.9/runs/20260612_130252/strategies_run4.json +37 -0
- minima_cli-0.4.9/runs/20260612_130252/strategies_run5.json +37 -0
- minima_cli-0.4.9/runs/20260612_130252/summary.json +75 -0
- minima_cli-0.4.9/runs/20260612_130252/tasks.jsonl +100 -0
- minima_cli-0.4.9/runs/20260612_182838/recall_debug.jsonl +42 -0
- minima_cli-0.4.9/runs/20260612_182838/strategies_run1.json +37 -0
- minima_cli-0.4.9/runs/20260612_182838/strategies_run2.json +37 -0
- minima_cli-0.4.9/runs/20260612_182838/tasks.jsonl +41 -0
- minima_cli-0.4.9/runs/20260612_183343/REPORT.md +152 -0
- minima_cli-0.4.9/runs/20260612_183343/memory_audit.json +48 -0
- minima_cli-0.4.9/runs/20260612_183343/recall_debug.jsonl +100 -0
- minima_cli-0.4.9/runs/20260612_183343/strategies_run1.json +37 -0
- minima_cli-0.4.9/runs/20260612_183343/strategies_run2.json +37 -0
- minima_cli-0.4.9/runs/20260612_183343/strategies_run3.json +37 -0
- minima_cli-0.4.9/runs/20260612_183343/strategies_run4.json +37 -0
- minima_cli-0.4.9/runs/20260612_183343/strategies_run5.json +37 -0
- minima_cli-0.4.9/runs/20260612_183343/summary.json +76 -0
- minima_cli-0.4.9/runs/20260612_183343/tasks.jsonl +100 -0
- minima_cli-0.4.9/runs/20260615_101732/REPORT.md +99 -0
- minima_cli-0.4.9/runs/20260615_101732/memory_audit.json +48 -0
- minima_cli-0.4.9/runs/20260615_101732/recall_debug.jsonl +100 -0
- minima_cli-0.4.9/runs/20260615_101732/strategies_run1.json +37 -0
- minima_cli-0.4.9/runs/20260615_101732/strategies_run2.json +37 -0
- minima_cli-0.4.9/runs/20260615_101732/strategies_run3.json +37 -0
- minima_cli-0.4.9/runs/20260615_101732/strategies_run4.json +37 -0
- minima_cli-0.4.9/runs/20260615_101732/strategies_run5.json +37 -0
- minima_cli-0.4.9/runs/20260615_101732/summary.json +77 -0
- minima_cli-0.4.9/runs/20260615_101732/tasks.jsonl +100 -0
- minima_cli-0.4.9/runs/escalate_20260615_133108/cold_probe.json +25 -0
- minima_cli-0.4.9/runs/escalate_20260615_133108/summary.json +99 -0
- minima_cli-0.4.9/runs/escalate_20260615_133108/tasks.jsonl +24 -0
- minima_cli-0.4.9/runs/escalate_20260615_134209/REPORT.md +80 -0
- minima_cli-0.4.9/runs/escalate_20260615_134209/cold_probe.json +25 -0
- minima_cli-0.4.9/runs/escalate_20260615_134209/summary.json +99 -0
- minima_cli-0.4.9/runs/escalate_20260615_134209/tasks.jsonl +24 -0
- minima_cli-0.4.9/runs/escalation_20260612_201825/REPORT.md +77 -0
- minima_cli-0.4.9/runs/escalation_20260612_201825/results.jsonl +60 -0
- minima_cli-0.4.9/runs/escalation_20260612_201825/summary.json +30 -0
- minima_cli-0.4.9/runs/retention_20260612_201828/REPORT.md +116 -0
- minima_cli-0.4.9/runs/retention_20260612_201828/results.jsonl +36 -0
- minima_cli-0.4.9/runs/retention_20260612_201828/summary.json +129 -0
- minima_cli-0.4.9/runs/warmupvary_20260615_123818/REPORT.md +83 -0
- minima_cli-0.4.9/runs/warmupvary_20260615_123818/summary.json +124 -0
- minima_cli-0.4.9/runs/warmupvary_20260615_123818/tasks.jsonl +48 -0
- minima_cli-0.4.9/src/minima/__init__.py +5 -0
- minima_cli-0.4.9/src/minima/api/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/api/auth.py +39 -0
- minima_cli-0.4.9/src/minima/api/errors.py +40 -0
- minima_cli-0.4.9/src/minima/api/routers/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/api/routers/calibration.py +50 -0
- minima_cli-0.4.9/src/minima/api/routers/feedback.py +279 -0
- minima_cli-0.4.9/src/minima/api/routers/health.py +50 -0
- minima_cli-0.4.9/src/minima/api/routers/models.py +42 -0
- minima_cli-0.4.9/src/minima/api/routers/recommend.py +66 -0
- minima_cli-0.4.9/src/minima/api/routers/savings.py +55 -0
- minima_cli-0.4.9/src/minima/api/routers/strategies.py +33 -0
- minima_cli-0.4.9/src/minima/catalog/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/catalog/data/capability_priors.json +210 -0
- minima_cli-0.4.9/src/minima/catalog/data/model_aliases.json +12 -0
- minima_cli-0.4.9/src/minima/catalog/merge.py +69 -0
- minima_cli-0.4.9/src/minima/catalog/refresh.py +54 -0
- minima_cli-0.4.9/src/minima/catalog/sources/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/catalog/sources/litellm.py +19 -0
- minima_cli-0.4.9/src/minima/catalog/sources/openrouter.py +25 -0
- minima_cli-0.4.9/src/minima/catalog/store.py +86 -0
- minima_cli-0.4.9/src/minima/config.py +288 -0
- minima_cli-0.4.9/src/minima/deps.py +35 -0
- minima_cli-0.4.9/src/minima/llm/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/llm/anthropic.py +106 -0
- minima_cli-0.4.9/src/minima/llm/base.py +196 -0
- minima_cli-0.4.9/src/minima/llm/gemini.py +124 -0
- minima_cli-0.4.9/src/minima/llm/registry.py +54 -0
- minima_cli-0.4.9/src/minima/logging.py +28 -0
- minima_cli-0.4.9/src/minima/main.py +109 -0
- minima_cli-0.4.9/src/minima/memory/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/memory/adapter.py +572 -0
- minima_cli-0.4.9/src/minima/memory/keys.py +83 -0
- minima_cli-0.4.9/src/minima/memory/records.py +190 -0
- minima_cli-0.4.9/src/minima/memory/threadpool.py +41 -0
- minima_cli-0.4.9/src/minima/metrics/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/metrics/calibration.py +415 -0
- minima_cli-0.4.9/src/minima/metrics/report.py +116 -0
- minima_cli-0.4.9/src/minima/metrics/savings.py +98 -0
- minima_cli-0.4.9/src/minima/recommender/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/recommender/_pg_pool.py +38 -0
- minima_cli-0.4.9/src/minima/recommender/_redis_client.py +32 -0
- minima_cli-0.4.9/src/minima/recommender/aggregate.py +157 -0
- minima_cli-0.4.9/src/minima/recommender/classify.py +165 -0
- minima_cli-0.4.9/src/minima/recommender/decisionlog.py +505 -0
- minima_cli-0.4.9/src/minima/recommender/durablerefs.py +312 -0
- minima_cli-0.4.9/src/minima/recommender/engine.py +997 -0
- minima_cli-0.4.9/src/minima/recommender/escalation.py +83 -0
- minima_cli-0.4.9/src/minima/recommender/propensity.py +189 -0
- minima_cli-0.4.9/src/minima/recommender/recstore.py +368 -0
- minima_cli-0.4.9/src/minima/recommender/score.py +318 -0
- minima_cli-0.4.9/src/minima/recommender/types.py +166 -0
- minima_cli-0.4.9/src/minima/schemas/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/schemas/common.py +73 -0
- minima_cli-0.4.9/src/minima/schemas/feedback.py +34 -0
- minima_cli-0.4.9/src/minima/schemas/models_catalog.py +36 -0
- minima_cli-0.4.9/src/minima/schemas/recommend.py +104 -0
- minima_cli-0.4.9/src/minima/schemas/savings.py +39 -0
- minima_cli-0.4.9/src/minima/schemas/strategies.py +57 -0
- minima_cli-0.4.9/src/minima/schemas/workflow.py +43 -0
- minima_cli-0.4.9/src/minima/seeding/__init__.py +1 -0
- minima_cli-0.4.9/src/minima/seeding/items.py +42 -0
- minima_cli-0.4.9/src/minima/seeding/llmrouterbench.py +232 -0
- minima_cli-0.4.9/src/minima/seeding/routerbench.py +141 -0
- minima_cli-0.4.9/src/minima/seeding/run_seed.py +56 -0
- minima_cli-0.4.9/src/minima/seeding/synthetic.py +70 -0
- minima_cli-0.4.9/src/minima/tenancy/__init__.py +8 -0
- minima_cli-0.4.9/src/minima/tenancy/context.py +37 -0
- minima_cli-0.4.9/src/minima/tenancy/passthrough.py +110 -0
- minima_cli-0.4.9/src/minima/version.py +3 -0
- minima_cli-0.4.9/src/minima_harness/LICENSE_PI +32 -0
- minima_cli-0.4.9/src/minima_harness/__init__.py +16 -0
- minima_cli-0.4.9/src/minima_harness/agent/__init__.py +72 -0
- minima_cli-0.4.9/src/minima_harness/agent/agent.py +276 -0
- minima_cli-0.4.9/src/minima_harness/agent/events.py +124 -0
- minima_cli-0.4.9/src/minima_harness/agent/loop.py +311 -0
- minima_cli-0.4.9/src/minima_harness/agent/state.py +79 -0
- minima_cli-0.4.9/src/minima_harness/agent/tools.py +97 -0
- minima_cli-0.4.9/src/minima_harness/ai/__init__.py +66 -0
- minima_cli-0.4.9/src/minima_harness/ai/compat.py +71 -0
- minima_cli-0.4.9/src/minima_harness/ai/errors.py +96 -0
- minima_cli-0.4.9/src/minima_harness/ai/events.py +117 -0
- minima_cli-0.4.9/src/minima_harness/ai/openrouter_catalog.py +153 -0
- minima_cli-0.4.9/src/minima_harness/ai/provider_catalog.py +299 -0
- minima_cli-0.4.9/src/minima_harness/ai/provider_quirks.py +37 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/__init__.py +75 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/_common.py +48 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/anthropic.py +290 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/base.py +65 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/faux.py +173 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/google.py +221 -0
- minima_cli-0.4.9/src/minima_harness/ai/providers/openai_compat.py +278 -0
- minima_cli-0.4.9/src/minima_harness/ai/registry.py +184 -0
- minima_cli-0.4.9/src/minima_harness/ai/stream.py +82 -0
- minima_cli-0.4.9/src/minima_harness/ai/tools.py +51 -0
- minima_cli-0.4.9/src/minima_harness/ai/types.py +204 -0
- minima_cli-0.4.9/src/minima_harness/ai/usage.py +41 -0
- minima_cli-0.4.9/src/minima_harness/minima/__init__.py +40 -0
- minima_cli-0.4.9/src/minima_harness/minima/cache.py +102 -0
- minima_cli-0.4.9/src/minima_harness/minima/config.py +85 -0
- minima_cli-0.4.9/src/minima_harness/minima/goals.py +226 -0
- minima_cli-0.4.9/src/minima_harness/minima/judge.py +144 -0
- minima_cli-0.4.9/src/minima_harness/minima/mapping.py +147 -0
- minima_cli-0.4.9/src/minima_harness/minima/meter.py +143 -0
- minima_cli-0.4.9/src/minima_harness/minima/router.py +220 -0
- minima_cli-0.4.9/src/minima_harness/minima/runtime.py +544 -0
- minima_cli-0.4.9/src/minima_harness/minima/signals.py +195 -0
- minima_cli-0.4.9/src/minima_harness/session/__init__.py +14 -0
- minima_cli-0.4.9/src/minima_harness/session/format.py +35 -0
- minima_cli-0.4.9/src/minima_harness/session/store.py +236 -0
- minima_cli-0.4.9/src/minima_harness/tasks/__init__.py +17 -0
- minima_cli-0.4.9/src/minima_harness/tasks/task_set.py +78 -0
- minima_cli-0.4.9/src/minima_harness/tools/__init__.py +7 -0
- minima_cli-0.4.9/src/minima_harness/tools/_io.py +34 -0
- minima_cli-0.4.9/src/minima_harness/tools/bash.py +70 -0
- minima_cli-0.4.9/src/minima_harness/tools/builtin.py +23 -0
- minima_cli-0.4.9/src/minima_harness/tools/edit.py +50 -0
- minima_cli-0.4.9/src/minima_harness/tools/find.py +38 -0
- minima_cli-0.4.9/src/minima_harness/tools/grep.py +73 -0
- minima_cli-0.4.9/src/minima_harness/tools/ls.py +35 -0
- minima_cli-0.4.9/src/minima_harness/tools/read.py +38 -0
- minima_cli-0.4.9/src/minima_harness/tools/tasks.py +75 -0
- minima_cli-0.4.9/src/minima_harness/tools/write.py +36 -0
- minima_cli-0.4.9/src/minima_harness/tui/__init__.py +3 -0
- minima_cli-0.4.9/src/minima_harness/tui/analytics.py +111 -0
- minima_cli-0.4.9/src/minima_harness/tui/app.py +1927 -0
- minima_cli-0.4.9/src/minima_harness/tui/bridge.py +103 -0
- minima_cli-0.4.9/src/minima_harness/tui/cli.py +227 -0
- minima_cli-0.4.9/src/minima_harness/tui/clipboard.py +60 -0
- minima_cli-0.4.9/src/minima_harness/tui/commands.py +49 -0
- minima_cli-0.4.9/src/minima_harness/tui/compaction.py +17 -0
- minima_cli-0.4.9/src/minima_harness/tui/config_cli.py +141 -0
- minima_cli-0.4.9/src/minima_harness/tui/config_store.py +237 -0
- minima_cli-0.4.9/src/minima_harness/tui/context.py +93 -0
- minima_cli-0.4.9/src/minima_harness/tui/customize.py +95 -0
- minima_cli-0.4.9/src/minima_harness/tui/diff.py +53 -0
- minima_cli-0.4.9/src/minima_harness/tui/editor.py +43 -0
- minima_cli-0.4.9/src/minima_harness/tui/extensions.py +84 -0
- minima_cli-0.4.9/src/minima_harness/tui/extra_models.py +52 -0
- minima_cli-0.4.9/src/minima_harness/tui/history.py +71 -0
- minima_cli-0.4.9/src/minima_harness/tui/mubit.py +295 -0
- minima_cli-0.4.9/src/minima_harness/tui/overlays.py +593 -0
- minima_cli-0.4.9/src/minima_harness/tui/packages.py +59 -0
- minima_cli-0.4.9/src/minima_harness/tui/run_modes.py +66 -0
- minima_cli-0.4.9/src/minima_harness/tui/theme.py +77 -0
- minima_cli-0.4.9/src/minima_harness/tui/welcome.py +83 -0
- minima_cli-0.4.9/src/minima_harness/tui/widgets/__init__.py +3 -0
- minima_cli-0.4.9/src/minima_harness/tui/widgets/banner.py +38 -0
- minima_cli-0.4.9/src/minima_harness/tui/widgets/editor.py +83 -0
- minima_cli-0.4.9/src/minima_harness/tui/widgets/footer.py +73 -0
- minima_cli-0.4.9/src/minima_harness/tui/widgets/messages.py +151 -0
- minima_cli-0.4.9/src/minima_harness/tui/widgets/status.py +57 -0
- minima_cli-0.4.9/tests/__init__.py +0 -0
- minima_cli-0.4.9/tests/conftest.py +54 -0
- minima_cli-0.4.9/tests/eval/BENCHMARKS.md +280 -0
- minima_cli-0.4.9/tests/eval/CRITERIA.md +251 -0
- minima_cli-0.4.9/tests/eval/RESULTS.md +141 -0
- minima_cli-0.4.9/tests/eval/__init__.py +1 -0
- minima_cli-0.4.9/tests/eval/harness.py +646 -0
- minima_cli-0.4.9/tests/eval/llmrouterbench_config.py +142 -0
- minima_cli-0.4.9/tests/eval/test_llmrouterbench_savings.py +100 -0
- minima_cli-0.4.9/tests/eval/test_routerbench_savings.py +145 -0
- minima_cli-0.4.9/tests/factories.py +169 -0
- minima_cli-0.4.9/tests/harness/__init__.py +0 -0
- minima_cli-0.4.9/tests/harness/session/__init__.py +0 -0
- minima_cli-0.4.9/tests/harness/session/test_format.py +23 -0
- minima_cli-0.4.9/tests/harness/session/test_manager.py +85 -0
- minima_cli-0.4.9/tests/harness/session/test_store.py +109 -0
- minima_cli-0.4.9/tests/harness/test_agent_loop.py +300 -0
- minima_cli-0.4.9/tests/harness/test_anthropic_mapping.py +310 -0
- minima_cli-0.4.9/tests/harness/test_auth_reroute.py +408 -0
- minima_cli-0.4.9/tests/harness/test_cache.py +65 -0
- minima_cli-0.4.9/tests/harness/test_catalog_overlay.py +104 -0
- minima_cli-0.4.9/tests/harness/test_common_and_wire.py +82 -0
- minima_cli-0.4.9/tests/harness/test_compat.py +74 -0
- minima_cli-0.4.9/tests/harness/test_errors.py +99 -0
- minima_cli-0.4.9/tests/harness/test_goals.py +153 -0
- minima_cli-0.4.9/tests/harness/test_google_mapping.py +182 -0
- minima_cli-0.4.9/tests/harness/test_judge.py +62 -0
- minima_cli-0.4.9/tests/harness/test_live.py +58 -0
- minima_cli-0.4.9/tests/harness/test_mapping.py +53 -0
- minima_cli-0.4.9/tests/harness/test_minima_e2e.py +150 -0
- minima_cli-0.4.9/tests/harness/test_openai_compat_sse.py +142 -0
- minima_cli-0.4.9/tests/harness/test_openrouter_catalog.py +134 -0
- minima_cli-0.4.9/tests/harness/test_phase0_smoke.py +162 -0
- minima_cli-0.4.9/tests/harness/test_phase_a.py +272 -0
- minima_cli-0.4.9/tests/harness/test_phase_b.py +119 -0
- minima_cli-0.4.9/tests/harness/test_phase_c.py +102 -0
- minima_cli-0.4.9/tests/harness/test_provider_catalog.py +102 -0
- minima_cli-0.4.9/tests/harness/test_provider_quirks.py +14 -0
- minima_cli-0.4.9/tests/harness/test_provider_registration.py +33 -0
- minima_cli-0.4.9/tests/harness/test_provider_wiring.py +166 -0
- minima_cli-0.4.9/tests/harness/test_runtime.py +491 -0
- minima_cli-0.4.9/tests/harness/test_signals.py +264 -0
- minima_cli-0.4.9/tests/harness/tools/__init__.py +0 -0
- minima_cli-0.4.9/tests/harness/tools/test_agent_smoke.py +21 -0
- minima_cli-0.4.9/tests/harness/tools/test_bash.py +41 -0
- minima_cli-0.4.9/tests/harness/tools/test_builtin.py +17 -0
- minima_cli-0.4.9/tests/harness/tools/test_edit.py +42 -0
- minima_cli-0.4.9/tests/harness/tools/test_find.py +22 -0
- minima_cli-0.4.9/tests/harness/tools/test_grep.py +30 -0
- minima_cli-0.4.9/tests/harness/tools/test_io.py +38 -0
- minima_cli-0.4.9/tests/harness/tools/test_ls.py +26 -0
- minima_cli-0.4.9/tests/harness/tools/test_read.py +34 -0
- minima_cli-0.4.9/tests/harness/tools/test_write.py +21 -0
- minima_cli-0.4.9/tests/harness/tui/__init__.py +0 -0
- minima_cli-0.4.9/tests/harness/tui/test_analytics.py +48 -0
- minima_cli-0.4.9/tests/harness/tui/test_app_pilot.py +70 -0
- minima_cli-0.4.9/tests/harness/tui/test_bridge.py +64 -0
- minima_cli-0.4.9/tests/harness/tui/test_clipboard.py +80 -0
- minima_cli-0.4.9/tests/harness/tui/test_command_popup.py +46 -0
- minima_cli-0.4.9/tests/harness/tui/test_commands.py +36 -0
- minima_cli-0.4.9/tests/harness/tui/test_config.py +279 -0
- minima_cli-0.4.9/tests/harness/tui/test_context.py +42 -0
- minima_cli-0.4.9/tests/harness/tui/test_customize.py +31 -0
- minima_cli-0.4.9/tests/harness/tui/test_decision_card.py +231 -0
- minima_cli-0.4.9/tests/harness/tui/test_diff.py +45 -0
- minima_cli-0.4.9/tests/harness/tui/test_editor.py +39 -0
- minima_cli-0.4.9/tests/harness/tui/test_editor_widget.py +53 -0
- minima_cli-0.4.9/tests/harness/tui/test_export.py +37 -0
- minima_cli-0.4.9/tests/harness/tui/test_extensions.py +76 -0
- minima_cli-0.4.9/tests/harness/tui/test_goals_tui.py +183 -0
- minima_cli-0.4.9/tests/harness/tui/test_history_sessions.py +151 -0
- minima_cli-0.4.9/tests/harness/tui/test_messages.py +64 -0
- minima_cli-0.4.9/tests/harness/tui/test_mouse_copy.py +101 -0
- minima_cli-0.4.9/tests/harness/tui/test_mubit.py +67 -0
- minima_cli-0.4.9/tests/harness/tui/test_optimize.py +118 -0
- minima_cli-0.4.9/tests/harness/tui/test_overlays.py +106 -0
- minima_cli-0.4.9/tests/harness/tui/test_p2.py +61 -0
- minima_cli-0.4.9/tests/harness/tui/test_p3.py +65 -0
- minima_cli-0.4.9/tests/harness/tui/test_p5.py +89 -0
- minima_cli-0.4.9/tests/harness/tui/test_permissions.py +142 -0
- minima_cli-0.4.9/tests/harness/tui/test_predictability.py +77 -0
- minima_cli-0.4.9/tests/harness/tui/test_prompt_layers.py +106 -0
- minima_cli-0.4.9/tests/harness/tui/test_queue.py +59 -0
- minima_cli-0.4.9/tests/harness/tui/test_run_modes.py +41 -0
- minima_cli-0.4.9/tests/harness/tui/test_status.py +24 -0
- minima_cli-0.4.9/tests/harness/tui/test_status_bar.py +45 -0
- minima_cli-0.4.9/tests/harness/tui/test_theme.py +21 -0
- minima_cli-0.4.9/tests/harness/tui/test_thoughts.py +70 -0
- minima_cli-0.4.9/tests/harness/tui/test_tool_render.py +65 -0
- minima_cli-0.4.9/tests/harness/tui/test_ux.py +228 -0
- minima_cli-0.4.9/tests/harness/tui/test_welcome.py +113 -0
- minima_cli-0.4.9/tests/harness/tui/test_widgets.py +126 -0
- minima_cli-0.4.9/tests/integration/test_escalation_reasoner.py +71 -0
- minima_cli-0.4.9/tests/integration/test_feedback_loop.py +81 -0
- minima_cli-0.4.9/tests/integration/test_lesson_promotion.py +80 -0
- minima_cli-0.4.9/tests/integration/test_measurement_api.py +292 -0
- minima_cli-0.4.9/tests/integration/test_observed_cost_ranking.py +153 -0
- minima_cli-0.4.9/tests/integration/test_recommend_api.py +55 -0
- minima_cli-0.4.9/tests/integration/test_strategies_api.py +44 -0
- minima_cli-0.4.9/tests/integration/test_workflow_models_health.py +53 -0
- minima_cli-0.4.9/tests/live/test_cost_savings_spotcheck_live.py +145 -0
- minima_cli-0.4.9/tests/live/test_escalation_fixes.py +293 -0
- minima_cli-0.4.9/tests/live/test_full_surface_live.py +505 -0
- minima_cli-0.4.9/tests/live/test_mubit_roundtrip.py +125 -0
- minima_cli-0.4.9/tests/live/test_phase3_live.py +97 -0
- minima_cli-0.4.9/tests/live/test_reasoner_live.py +135 -0
- minima_cli-0.4.9/tests/live/test_recall_params_live.py +215 -0
- minima_cli-0.4.9/tests/unit/test_aggregate.py +81 -0
- minima_cli-0.4.9/tests/unit/test_aggregate_decay.py +117 -0
- minima_cli-0.4.9/tests/unit/test_autocapture.py +75 -0
- minima_cli-0.4.9/tests/unit/test_calibration_fit.py +125 -0
- minima_cli-0.4.9/tests/unit/test_classify_keys.py +53 -0
- minima_cli-0.4.9/tests/unit/test_cluster.py +40 -0
- minima_cli-0.4.9/tests/unit/test_collapse_guard.py +161 -0
- minima_cli-0.4.9/tests/unit/test_cost_band.py +78 -0
- minima_cli-0.4.9/tests/unit/test_decisionlog.py +150 -0
- minima_cli-0.4.9/tests/unit/test_escalation.py +151 -0
- minima_cli-0.4.9/tests/unit/test_exploration.py +56 -0
- minima_cli-0.4.9/tests/unit/test_ipw.py +48 -0
- minima_cli-0.4.9/tests/unit/test_iterations.py +73 -0
- minima_cli-0.4.9/tests/unit/test_latency_quality.py +98 -0
- minima_cli-0.4.9/tests/unit/test_lever_cost.py +67 -0
- minima_cli-0.4.9/tests/unit/test_metrics.py +143 -0
- minima_cli-0.4.9/tests/unit/test_metrics_demo.py +115 -0
- minima_cli-0.4.9/tests/unit/test_neighbor_classify.py +62 -0
- minima_cli-0.4.9/tests/unit/test_reasoner.py +105 -0
- minima_cli-0.4.9/tests/unit/test_records_catalog.py +81 -0
- minima_cli-0.4.9/tests/unit/test_recstore_sqlite.py +80 -0
- minima_cli-0.4.9/tests/unit/test_score.py +132 -0
- minima_cli-0.4.9/tests/unit/test_shadow_bandit.py +74 -0
- minima_cli-0.4.9/tests/unit/test_store_backends.py +495 -0
- minima_cli-0.4.9/tests/unit/test_strategies.py +48 -0
- minima_cli-0.4.9/tests/unit/test_tenancy.py +114 -0
- minima_cli-0.4.9/tests/unit/test_thompson.py +69 -0
- minima_cli-0.4.9/uv.lock +2947 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
{
|
|
2
|
+
"permissions": {
|
|
3
|
+
"allow": [
|
|
4
|
+
"Bash(gcloud sql instances describe *)",
|
|
5
|
+
"Bash(gcloud redis *)",
|
|
6
|
+
"Bash(gcloud run services describe *)",
|
|
7
|
+
"Bash(curl -s -H 'Authorization: Bearer GkqgKc3c0eFMK1LwgNhXV60GuXNJYXE1gDulAIyuWOuerymE' https://minima-staging-ftvjoyasma-ez.a.run.app/v1/health)",
|
|
8
|
+
"Bash(python3 -m json.tool)",
|
|
9
|
+
"Bash(curl -s -H 'Authorization: Bearer mbt_shankha-dev_cavgtceg2cyxzzkb_Omvp2p4l3bGxhoxzYBDoCYYyzylKM8hmyYzarJuzfduf1NdlDBL5pXgR86IodpGz' https://minima-staging-ftvjoyasma-ez.a.run.app/v1/health)"
|
|
10
|
+
]
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
# Version control
|
|
2
|
+
.git/
|
|
3
|
+
.github/
|
|
4
|
+
|
|
5
|
+
# Python artifacts
|
|
6
|
+
.venv/
|
|
7
|
+
__pycache__/
|
|
8
|
+
*.pyc
|
|
9
|
+
*.pyo
|
|
10
|
+
*.pyd
|
|
11
|
+
*.egg-info/
|
|
12
|
+
dist/
|
|
13
|
+
build/
|
|
14
|
+
|
|
15
|
+
# Dev tools
|
|
16
|
+
.pytest_cache/
|
|
17
|
+
.mypy_cache/
|
|
18
|
+
.ruff_cache/
|
|
19
|
+
.coverage
|
|
20
|
+
|
|
21
|
+
# Secrets — never in the image
|
|
22
|
+
.env
|
|
23
|
+
.env.*
|
|
24
|
+
|
|
25
|
+
# Docs and examples (not needed at runtime)
|
|
26
|
+
docs/
|
|
27
|
+
docs-site/
|
|
28
|
+
examples/
|
|
29
|
+
|
|
30
|
+
# Tests
|
|
31
|
+
tests/
|
|
32
|
+
|
|
33
|
+
# Misc
|
|
34
|
+
*.md
|
|
35
|
+
!README.md
|
|
36
|
+
uv.lock.bak
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
# --- Mubit memory backend ---
|
|
2
|
+
# Auth is pass-through: callers present their own Mubit key as Authorization: Bearer.
|
|
3
|
+
# MUBIT_API_KEY here is only the local/dev default (single-key mode); hosted Minima
|
|
4
|
+
# never stores caller keys.
|
|
5
|
+
# Leave MUBIT_ENDPOINT unset for the hosted default (https://api.mubit.ai). Uncomment and
|
|
6
|
+
# point it at a LOCAL Mubit runtime ONLY for server development — a stray localhost value
|
|
7
|
+
# copied into ./.env would silently degrade the `minima` CLI's memory to offline.
|
|
8
|
+
# MUBIT_ENDPOINT=http://127.0.0.1:3000
|
|
9
|
+
MUBIT_API_KEY=
|
|
10
|
+
# http is the proven transport for the local runtime: recall uses mode=direct_bypass,
|
|
11
|
+
# which the runtime's gRPC QueryMode enum does not accept (auto may pick gRPC and fail).
|
|
12
|
+
# NOTE: recall (mode=direct_bypass) requires the org's instance to have
|
|
13
|
+
# enable_direct_search=true (default false on hosted Mubit instances).
|
|
14
|
+
MUBIT_TRANSPORT=http
|
|
15
|
+
MUBIT_TIMEOUT_MS=30000
|
|
16
|
+
|
|
17
|
+
# --- Memory read path ---
|
|
18
|
+
# Recall includes a server-side embedding round-trip; latency is embedder-bound
|
|
19
|
+
# (~100-300ms on a GPU embedder, ~1.5s on a local CPU one). Bounds recommendation latency.
|
|
20
|
+
MINIMA_MEMORY_RECALL_TIMEOUT_MS=2500
|
|
21
|
+
MINIMA_MEMORY_RECALL_LIMIT=25
|
|
22
|
+
# agent_routed works on all Mubit instances including hosted api.mubit.ai.
|
|
23
|
+
# direct_bypass is lower-latency but requires enable_direct_search=true on the instance
|
|
24
|
+
# (default false on hosted Mubit; safe to use with a local Mubit runtime).
|
|
25
|
+
MINIMA_RECALL_MODE=agent_routed
|
|
26
|
+
MINIMA_LANE_PREFIX=minima
|
|
27
|
+
MINIMA_SEED_LANE=minima:default
|
|
28
|
+
# Server-side recall precision (all have legacy escape hatches: empty string = off).
|
|
29
|
+
# Entry types covering both intake paths (seeds=fact, feedback=observation).
|
|
30
|
+
MINIMA_RECALL_ENTRY_TYPES=fact,observation
|
|
31
|
+
# relevance | freshness | balanced — balanced lets recency influence WHICH neighbors
|
|
32
|
+
# arrive; per-neighbor age weighting is the client-side half-life decay below.
|
|
33
|
+
MINIMA_RECALL_RANK_BY=balanced
|
|
34
|
+
# Hard recency window in days (0 = no window).
|
|
35
|
+
MINIMA_RECALL_MAX_AGE_DAYS=0
|
|
36
|
+
# Mubit search budget tier: low | mid | high.
|
|
37
|
+
MINIMA_RECALL_BUDGET=mid
|
|
38
|
+
# Log per-evidence score breakdowns (diagnostic; keep off in prod).
|
|
39
|
+
MINIMA_RECALL_EXPLAIN=false
|
|
40
|
+
|
|
41
|
+
# --- Recommender tuning ---
|
|
42
|
+
MINIMA_TAU_MIN=0.55
|
|
43
|
+
MINIMA_TAU_MAX=0.92
|
|
44
|
+
MINIMA_BETA_PSEUDOCOUNT=2.5
|
|
45
|
+
MINIMA_ESCALATION_W_MIN=1.5
|
|
46
|
+
MINIMA_ESCALATION_N_MIN=3
|
|
47
|
+
MINIMA_ESCALATION_C_MIN=0.45
|
|
48
|
+
MINIMA_ESCALATION_TIE_DELTA=0.05
|
|
49
|
+
# legacy = four independent triggers; uncertainty = posterior-interval gate replaces
|
|
50
|
+
# thin_evidence+low_confidence (conflict stays a hard override). Shadow before switching.
|
|
51
|
+
MINIMA_ESCALATION_MODE=legacy
|
|
52
|
+
MINIMA_ESCALATION_INTERVAL_WIDTH=0.25
|
|
53
|
+
MINIMA_DEFAULT_INPUT_TOKENS=1500
|
|
54
|
+
MINIMA_DEFAULT_OUTPUT_TOKENS=500
|
|
55
|
+
MINIMA_REFLECT_EVERY_N=25
|
|
56
|
+
# Rank candidates by what they REALLY cost, not a flat token estimate that ignores
|
|
57
|
+
# reasoning/thinking tokens. With >=MIN_N observations per candidate the engine re-scales the
|
|
58
|
+
# model's observed output behaviour to this request's input size (size-exact + reasoning-aware);
|
|
59
|
+
# with cost-but-no-token history it uses the robust median realized $/call; otherwise it falls
|
|
60
|
+
# back to the token estimate. One basis is chosen for the whole candidate set (no apples-to-oranges).
|
|
61
|
+
MINIMA_USE_OBSERVED_COST=true
|
|
62
|
+
MINIMA_OBSERVED_COST_MIN_N=3
|
|
63
|
+
# Evidence age decay: a recalled outcome's weight halves every half-life (records
|
|
64
|
+
# without a timestamp keep the legacy binary stale penalty). Floor bounds old evidence.
|
|
65
|
+
MINIMA_EVIDENCE_HALF_LIFE_DAYS=30.0
|
|
66
|
+
MINIMA_EVIDENCE_DECAY_FLOOR=0.1
|
|
67
|
+
# Seeded outcomes count at SEED_WEIGHT, crowded out linearly once a model has
|
|
68
|
+
# CROWDOUT_N live outcomes in the recalled set. 1.0/0 = legacy (seeds at full weight).
|
|
69
|
+
MINIMA_SEED_WEIGHT=0.5
|
|
70
|
+
MINIMA_SEED_CROWDOUT_N=5
|
|
71
|
+
# Latency annotation/enforcement (Constraints.max_latency_ms): robust observed
|
|
72
|
+
# percentile, only for candidates with >= MIN_N latency observations.
|
|
73
|
+
MINIMA_LATENCY_PERCENTILE=0.75
|
|
74
|
+
MINIMA_LATENCY_MIN_N=3
|
|
75
|
+
# Default-output-token multipliers by classified difficulty (JSON dict), applied to
|
|
76
|
+
# MINIMA_DEFAULT_OUTPUT_TOKENS when the caller omits expected_output_tokens.
|
|
77
|
+
# Affects the "estimate" cost basis only.
|
|
78
|
+
MINIMA_DIFFICULTY_OUTPUT_MULTIPLIERS={"trivial": 0.5, "easy": 0.75, "medium": 1.0, "hard": 1.5, "expert": 2.0}
|
|
79
|
+
|
|
80
|
+
# --- Cheap-LLM reasoner (recommend-only); set provider=anthropic|gemini + the matching key ---
|
|
81
|
+
# Requires the provider extra: `uv sync --extra reasoner-anthropic` and/or `--extra reasoner-gemini`.
|
|
82
|
+
MINIMA_REASONER_PROVIDER=none
|
|
83
|
+
MINIMA_REASONER_MODEL=
|
|
84
|
+
MINIMA_REASONER_TIMEOUT_MS=15000
|
|
85
|
+
# Output cap. Gemini 3.x reasons before emitting JSON; <4096 can truncate the response.
|
|
86
|
+
MINIMA_REASONER_MAX_TOKENS=4096
|
|
87
|
+
MINIMA_REASONER_BLEND=0.5
|
|
88
|
+
# Adaptive blend: weight the LLM's estimate by how thin the deterministic evidence is
|
|
89
|
+
# (cold candidates lean on the LLM; well-evidenced ones barely move). false = fixed blend.
|
|
90
|
+
MINIMA_REASONER_BLEND_ADAPTIVE=true
|
|
91
|
+
MINIMA_REASONER_BLEND_MAX=0.8
|
|
92
|
+
MINIMA_REASONER_CLASSIFY=true
|
|
93
|
+
ANTHROPIC_API_KEY=
|
|
94
|
+
GEMINI_API_KEY=
|
|
95
|
+
|
|
96
|
+
# --- Selection-bias correction (inverse propensity weighting) ---
|
|
97
|
+
MINIMA_IPW_ENABLED=true
|
|
98
|
+
MINIMA_IPW_CLIP_LOW=0.1
|
|
99
|
+
MINIMA_IPW_CLIP_HIGH=10.0
|
|
100
|
+
|
|
101
|
+
# --- Learning maturity (Phase 3) ---
|
|
102
|
+
# Cluster granularity for the per-(cluster, model) upsert key. coarse = task_type:difficulty;
|
|
103
|
+
# fine appends a salient-keyword signature so distinct topics accumulate separately.
|
|
104
|
+
MINIMA_CLUSTER_GRANULARITY=coarse
|
|
105
|
+
MINIMA_CLUSTER_SIGNATURE_TOKENS=4
|
|
106
|
+
# Promote a verified-in-production strong success to a durable Lesson (feeds reflect()).
|
|
107
|
+
MINIMA_LESSON_ON_VERIFIED_PROD=true
|
|
108
|
+
MINIMA_LESSON_MIN_QUALITY=0.8
|
|
109
|
+
# Optimistic bonus for under-explored candidates (0.0 = off; pure exploitation).
|
|
110
|
+
MINIMA_EXPLORATION_BONUS=0.0
|
|
111
|
+
|
|
112
|
+
# --- Catalog ---
|
|
113
|
+
MINIMA_CATALOG_REFRESH_SECONDS=21600
|
|
114
|
+
MINIMA_CATALOG_STALE_AFTER_SECONDS=86400
|
|
115
|
+
MINIMA_LITELLM_PRICES_URL=https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json
|
|
116
|
+
MINIMA_OPENROUTER_MODELS_URL=https://openrouter.ai/api/v1/models
|
|
117
|
+
OPENROUTER_API_KEY=
|
|
118
|
+
|
|
119
|
+
# --- Service ---
|
|
120
|
+
MINIMA_HOST=0.0.0.0
|
|
121
|
+
# NOTE: a local Mubit embedding server commonly runs on :8080; pick another port for Minima.
|
|
122
|
+
MINIMA_PORT=8088
|
|
123
|
+
MINIMA_LOG_LEVEL=info
|
|
124
|
+
# memory | sqlite | cloudsql — controls DecisionLog, Propensity, and RecStore + DurableRefs
|
|
125
|
+
# unless MINIMA_RECSTORE_BACKEND overrides the operational stores.
|
|
126
|
+
# memory — in-process; lost on restart. Fine for local dev.
|
|
127
|
+
# sqlite — SQLite on MINIMA_SQLITE_PATH. NOTE: /tmp is ephemeral on Cloud Run.
|
|
128
|
+
# cloudsql — PostgreSQL via Cloud SQL Auth Proxy (requires MINIMA_DATABASE_URL).
|
|
129
|
+
MINIMA_RECOMMENDATION_STORE=memory
|
|
130
|
+
# 7 days: feedback often arrives late (batch evals, prod verification). After expiry the
|
|
131
|
+
# late-feedback path still accepts outcomes (without neighbor attribution).
|
|
132
|
+
MINIMA_RECOMMENDATION_TTL_SECONDS=604800
|
|
133
|
+
MINIMA_SQLITE_PATH=minima_state.db
|
|
134
|
+
MINIMA_LATE_FEEDBACK_ENABLED=true
|
|
135
|
+
|
|
136
|
+
# --- Persistent store backends (Cloud SQL + Redis) ---
|
|
137
|
+
# PostgreSQL DSN — required when MINIMA_RECOMMENDATION_STORE=cloudsql.
|
|
138
|
+
# Cloud Run (Auth Proxy socket): postgresql://app_user:PASSWORD@/minima?host=/cloudsql/PROJECT:REGION:INSTANCE
|
|
139
|
+
# Local (TCP): postgresql://app_user:PASSWORD@localhost:5432/minima
|
|
140
|
+
MINIMA_DATABASE_URL=
|
|
141
|
+
# Redis URL — required when MINIMA_RECSTORE_BACKEND=redis (Cloud Memorystore private IP).
|
|
142
|
+
MINIMA_REDIS_URL=redis://localhost:6379/0
|
|
143
|
+
# Override backend for RecStore + DurableRefs independently of MINIMA_RECOMMENDATION_STORE.
|
|
144
|
+
# redis — Redis/Memorystore (TTL-native, low-latency); requires MINIMA_REDIS_URL
|
|
145
|
+
# cloudsql — PostgreSQL (same DB as DecisionLog/Propensity)
|
|
146
|
+
# empty — inherit from MINIMA_RECOMMENDATION_STORE (default)
|
|
147
|
+
MINIMA_RECSTORE_BACKEND=
|
|
148
|
+
|
|
149
|
+
# --- Decision logging & off-policy evaluation ---
|
|
150
|
+
# Every recommendation is logged (candidate set, propensity vector, tau, cost baselines)
|
|
151
|
+
# and reconciled at feedback. Powers GET /v1/savings, GET /v1/calibration, feedback
|
|
152
|
+
# coverage, and the minima-calibration-report script.
|
|
153
|
+
MINIMA_DECISION_LOG_RETENTION_DAYS=90
|
|
154
|
+
# Comma-separated org ids opted into epsilon-stochastic selection (sampling within the
|
|
155
|
+
# tau-eligible set). Empty = deterministic argmin everywhere (default).
|
|
156
|
+
MINIMA_EPSILON_SELECTION_ORGS=
|
|
157
|
+
MINIMA_EPSILON=0.03
|
|
158
|
+
MINIMA_EPSILON_SOFTMAX_TEMPERATURE=0.1
|
|
159
|
+
|
|
160
|
+
# --- Calibration monitoring ---
|
|
161
|
+
MINIMA_CALIBRATION_WINDOW_DAYS=30
|
|
162
|
+
MINIMA_CALIBRATION_SHRINKAGE_K=20.0
|
|
163
|
+
MINIMA_CALIBRATION_BINS=10
|
|
164
|
+
# CUSUM drift detection, sized for binary residuals (smaller values flag healthy streams).
|
|
165
|
+
MINIMA_CUSUM_K=0.25
|
|
166
|
+
MINIMA_CUSUM_H=2.0
|
|
167
|
+
|
|
168
|
+
# --- Durable-record fast path ---
|
|
169
|
+
# off | shadow (fetch + log what ANN missed, don't merge) | on (merge into evidence).
|
|
170
|
+
MINIMA_DURABLE_FASTPATH=off
|
|
171
|
+
MINIMA_DURABLE_FASTPATH_MAX_REFS=8
|
|
172
|
+
|
|
173
|
+
# --- Tenancy ---
|
|
174
|
+
# Auth is pass-through (the caller's Mubit key IS the credential; org id is derived from
|
|
175
|
+
# it). This org id only partitions single-key/dev state (recstore/propensity/decisions).
|
|
176
|
+
MINIMA_DEFAULT_ORG_ID=default
|
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
name: Deploy — Production
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
release:
|
|
5
|
+
types: [published]
|
|
6
|
+
# Manual re-deploy of any tag (e.g. when a tag predates a workflow fix, or to redeploy).
|
|
7
|
+
# Dispatch from the default branch so it uses the current workflow definition/runner.
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
inputs:
|
|
10
|
+
tag:
|
|
11
|
+
description: "Git tag to build & deploy (e.g. v0.4.3)"
|
|
12
|
+
required: true
|
|
13
|
+
type: string
|
|
14
|
+
|
|
15
|
+
concurrency:
|
|
16
|
+
group: deploy-minima-prod
|
|
17
|
+
cancel-in-progress: false
|
|
18
|
+
|
|
19
|
+
env:
|
|
20
|
+
PROJECT: mubit-prod
|
|
21
|
+
REGION: europe-west4
|
|
22
|
+
REGISTRY: europe-west4-docker.pkg.dev/mubit-prod/minima
|
|
23
|
+
SERVICE_NAME: minima-prod
|
|
24
|
+
DOCS_SERVICE: minima-docs-prod
|
|
25
|
+
RELEASE_TAG: ${{ github.event.release.tag_name || inputs.tag }}
|
|
26
|
+
# Cloud SQL Auth Proxy — new dedicated Minima instance (not shared with console-db)
|
|
27
|
+
CLOUDSQL_INSTANCE: mubit-prod:europe-west4:minima-prod-db
|
|
28
|
+
# VPC for Cloud Memorystore (Redis) connectivity
|
|
29
|
+
NETWORK: mubit-prod-eu-network
|
|
30
|
+
SUBNET: mubit-prod-eu-subnet
|
|
31
|
+
|
|
32
|
+
permissions:
|
|
33
|
+
contents: read
|
|
34
|
+
id-token: write
|
|
35
|
+
|
|
36
|
+
jobs:
|
|
37
|
+
|
|
38
|
+
# ── 1. Minima service ───────────────────────────────────────────────────────
|
|
39
|
+
deploy-service:
|
|
40
|
+
name: Service → Cloud Run (prod)
|
|
41
|
+
runs-on: ubuntu-latest
|
|
42
|
+
|
|
43
|
+
steps:
|
|
44
|
+
- name: Checkout @ release tag
|
|
45
|
+
uses: actions/checkout@v5
|
|
46
|
+
with:
|
|
47
|
+
ref: ${{ env.RELEASE_TAG }}
|
|
48
|
+
|
|
49
|
+
- name: Authenticate to GCP
|
|
50
|
+
uses: google-github-actions/auth@v2
|
|
51
|
+
with:
|
|
52
|
+
project_id: ${{ env.PROJECT }}
|
|
53
|
+
workload_identity_provider: ${{ secrets.GCP_PROD_WIF_PROVIDER }}
|
|
54
|
+
service_account: ${{ secrets.GCP_PROD_DEPLOYER_SA }}
|
|
55
|
+
|
|
56
|
+
- name: Configure Docker for Artifact Registry
|
|
57
|
+
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
|
|
58
|
+
|
|
59
|
+
- name: Set up Docker Buildx
|
|
60
|
+
uses: docker/setup-buildx-action@v3
|
|
61
|
+
|
|
62
|
+
- name: Build and push service image
|
|
63
|
+
uses: docker/build-push-action@v6
|
|
64
|
+
with:
|
|
65
|
+
context: .
|
|
66
|
+
file: ./Dockerfile
|
|
67
|
+
push: true
|
|
68
|
+
tags: |
|
|
69
|
+
${{ env.REGISTRY }}/minima-service:${{ env.RELEASE_TAG }}
|
|
70
|
+
${{ env.REGISTRY }}/minima-service:latest
|
|
71
|
+
cache-from: type=gha,scope=minima-service-prod
|
|
72
|
+
cache-to: type=gha,mode=max,scope=minima-service-prod
|
|
73
|
+
|
|
74
|
+
- name: Deploy service to Cloud Run (prod)
|
|
75
|
+
run: |
|
|
76
|
+
gcloud run deploy ${{ env.SERVICE_NAME }} \
|
|
77
|
+
--image ${{ env.REGISTRY }}/minima-service:${{ env.RELEASE_TAG }} \
|
|
78
|
+
--region ${{ env.REGION }} \
|
|
79
|
+
--platform managed \
|
|
80
|
+
--port 8080 \
|
|
81
|
+
--cpu 2 \
|
|
82
|
+
--memory 2Gi \
|
|
83
|
+
--min-instances 1 \
|
|
84
|
+
--max-instances 20 \
|
|
85
|
+
--allow-unauthenticated \
|
|
86
|
+
--service-account ${{ secrets.GCP_PROD_DEPLOYER_SA }} \
|
|
87
|
+
--add-cloudsql-instances=${{ env.CLOUDSQL_INSTANCE }} \
|
|
88
|
+
--network=${{ env.NETWORK }} \
|
|
89
|
+
--subnet=${{ env.SUBNET }} \
|
|
90
|
+
--vpc-egress=private-ranges-only \
|
|
91
|
+
--set-env-vars="MUBIT_ENDPOINT=https://api.mubit.ai,MUBIT_TRANSPORT=http,MINIMA_RECALL_MODE=agent_routed,MINIMA_LOG_LEVEL=info,MINIMA_RECOMMENDATION_STORE=cloudsql,MINIMA_RECSTORE_BACKEND=redis,MINIMA_REASONER_PROVIDER=gemini,MINIMA_REASONER_MODEL=gemini-3.5-flash" \
|
|
92
|
+
--set-secrets="GEMINI_API_KEY=minima-prod-gemini-key:latest,ANTHROPIC_API_KEY=minima-prod-anthropic-key:latest,OPENROUTER_API_KEY=minima-prod-openrouter-key:latest,MINIMA_DATABASE_URL=minima-prod-db-url:latest,MINIMA_REDIS_URL=minima-prod-redis-url:latest" \
|
|
93
|
+
--quiet
|
|
94
|
+
|
|
95
|
+
- name: Print service URL
|
|
96
|
+
run: |
|
|
97
|
+
URL=$(gcloud run services describe ${{ env.SERVICE_NAME }} \
|
|
98
|
+
--region ${{ env.REGION }} \
|
|
99
|
+
--format 'value(status.url)')
|
|
100
|
+
echo "::notice::Minima service (prod) deployed to: $URL"
|
|
101
|
+
|
|
102
|
+
# ── 2. Docs site ────────────────────────────────────────────────────────────
|
|
103
|
+
deploy-docs:
|
|
104
|
+
name: Docs → Cloud Run (prod)
|
|
105
|
+
runs-on: ubuntu-latest
|
|
106
|
+
|
|
107
|
+
steps:
|
|
108
|
+
- name: Checkout @ release tag
|
|
109
|
+
uses: actions/checkout@v5
|
|
110
|
+
with:
|
|
111
|
+
ref: ${{ env.RELEASE_TAG }}
|
|
112
|
+
|
|
113
|
+
- name: Authenticate to GCP
|
|
114
|
+
uses: google-github-actions/auth@v2
|
|
115
|
+
with:
|
|
116
|
+
project_id: ${{ env.PROJECT }}
|
|
117
|
+
workload_identity_provider: ${{ secrets.GCP_PROD_WIF_PROVIDER }}
|
|
118
|
+
service_account: ${{ secrets.GCP_PROD_DEPLOYER_SA }}
|
|
119
|
+
|
|
120
|
+
- name: Configure Docker for Artifact Registry
|
|
121
|
+
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
|
|
122
|
+
|
|
123
|
+
- name: Set up Docker Buildx
|
|
124
|
+
uses: docker/setup-buildx-action@v3
|
|
125
|
+
|
|
126
|
+
- name: Build and push docs image
|
|
127
|
+
uses: docker/build-push-action@v6
|
|
128
|
+
with:
|
|
129
|
+
context: ./docs-site
|
|
130
|
+
file: ./docs-site/Dockerfile
|
|
131
|
+
push: true
|
|
132
|
+
tags: |
|
|
133
|
+
${{ env.REGISTRY }}/minima-docs:${{ env.RELEASE_TAG }}
|
|
134
|
+
${{ env.REGISTRY }}/minima-docs:latest
|
|
135
|
+
cache-from: type=gha,scope=minima-docs-prod
|
|
136
|
+
cache-to: type=gha,mode=max,scope=minima-docs-prod
|
|
137
|
+
|
|
138
|
+
- name: Deploy docs to Cloud Run (prod)
|
|
139
|
+
run: |
|
|
140
|
+
gcloud run deploy ${{ env.DOCS_SERVICE }} \
|
|
141
|
+
--image ${{ env.REGISTRY }}/minima-docs:${{ env.RELEASE_TAG }} \
|
|
142
|
+
--region ${{ env.REGION }} \
|
|
143
|
+
--platform managed \
|
|
144
|
+
--port 8080 \
|
|
145
|
+
--cpu 1 \
|
|
146
|
+
--memory 256Mi \
|
|
147
|
+
--min-instances 1 \
|
|
148
|
+
--max-instances 5 \
|
|
149
|
+
--allow-unauthenticated \
|
|
150
|
+
--service-account ${{ secrets.GCP_PROD_DEPLOYER_SA }} \
|
|
151
|
+
--quiet
|
|
152
|
+
|
|
153
|
+
- name: Print docs URL
|
|
154
|
+
run: |
|
|
155
|
+
URL=$(gcloud run services describe ${{ env.DOCS_SERVICE }} \
|
|
156
|
+
--region ${{ env.REGION }} \
|
|
157
|
+
--format 'value(status.url)')
|
|
158
|
+
echo "::notice::Minima docs (prod) deployed to: $URL"
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
name: Deploy — Staging
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [staging]
|
|
6
|
+
# Manual deploy of any branch/ref to staging (dispatch on the ref you want deployed).
|
|
7
|
+
workflow_dispatch:
|
|
8
|
+
|
|
9
|
+
concurrency:
|
|
10
|
+
group: deploy-minima-staging
|
|
11
|
+
cancel-in-progress: true
|
|
12
|
+
|
|
13
|
+
env:
|
|
14
|
+
PROJECT: mubit-dev-489910
|
|
15
|
+
REGION: europe-west4
|
|
16
|
+
REGISTRY: europe-west4-docker.pkg.dev/mubit-dev-489910/minima
|
|
17
|
+
SERVICE_NAME: minima-staging
|
|
18
|
+
DOCS_SERVICE: minima-docs-staging
|
|
19
|
+
IMAGE_TAG: staging-${{ github.sha }}
|
|
20
|
+
# Cloud SQL Auth Proxy — new dedicated Minima instance (not shared with console-db)
|
|
21
|
+
CLOUDSQL_INSTANCE: mubit-dev-489910:europe-west4:minima-staging-db
|
|
22
|
+
# VPC for Cloud Memorystore (Redis) connectivity
|
|
23
|
+
NETWORK: mubit-dev-eu-network
|
|
24
|
+
SUBNET: mubit-dev-eu-subnet
|
|
25
|
+
|
|
26
|
+
permissions:
|
|
27
|
+
contents: read
|
|
28
|
+
id-token: write
|
|
29
|
+
|
|
30
|
+
jobs:
|
|
31
|
+
|
|
32
|
+
# ── 1. Minima service ───────────────────────────────────────────────────────
|
|
33
|
+
deploy-service:
|
|
34
|
+
name: Service → Cloud Run (staging)
|
|
35
|
+
runs-on: ubuntu-latest
|
|
36
|
+
|
|
37
|
+
steps:
|
|
38
|
+
- name: Checkout
|
|
39
|
+
uses: actions/checkout@v5
|
|
40
|
+
|
|
41
|
+
- name: Authenticate to GCP
|
|
42
|
+
uses: google-github-actions/auth@v2
|
|
43
|
+
with:
|
|
44
|
+
project_id: ${{ env.PROJECT }}
|
|
45
|
+
workload_identity_provider: ${{ secrets.GCP_WIF_PROVIDER }}
|
|
46
|
+
service_account: ${{ secrets.GCP_DEPLOYER_SA }}
|
|
47
|
+
|
|
48
|
+
- name: Configure Docker for Artifact Registry
|
|
49
|
+
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
|
|
50
|
+
|
|
51
|
+
- name: Set up Docker Buildx
|
|
52
|
+
uses: docker/setup-buildx-action@v3
|
|
53
|
+
|
|
54
|
+
- name: Build and push service image
|
|
55
|
+
uses: docker/build-push-action@v6
|
|
56
|
+
with:
|
|
57
|
+
context: .
|
|
58
|
+
file: ./Dockerfile
|
|
59
|
+
push: true
|
|
60
|
+
tags: |
|
|
61
|
+
${{ env.REGISTRY }}/minima-service:${{ env.IMAGE_TAG }}
|
|
62
|
+
${{ env.REGISTRY }}/minima-service:staging-latest
|
|
63
|
+
cache-from: type=gha,scope=minima-service-staging
|
|
64
|
+
cache-to: type=gha,mode=max,scope=minima-service-staging
|
|
65
|
+
|
|
66
|
+
- name: Deploy service to Cloud Run (staging)
|
|
67
|
+
run: |
|
|
68
|
+
gcloud run deploy ${{ env.SERVICE_NAME }} \
|
|
69
|
+
--image ${{ env.REGISTRY }}/minima-service:${{ env.IMAGE_TAG }} \
|
|
70
|
+
--region ${{ env.REGION }} \
|
|
71
|
+
--platform managed \
|
|
72
|
+
--port 8080 \
|
|
73
|
+
--cpu 1 \
|
|
74
|
+
--memory 1Gi \
|
|
75
|
+
--min-instances 1 \
|
|
76
|
+
--max-instances 10 \
|
|
77
|
+
--allow-unauthenticated \
|
|
78
|
+
--service-account ${{ secrets.GCP_DEPLOYER_SA }} \
|
|
79
|
+
--add-cloudsql-instances=${{ env.CLOUDSQL_INSTANCE }} \
|
|
80
|
+
--network=${{ env.NETWORK }} \
|
|
81
|
+
--subnet=${{ env.SUBNET }} \
|
|
82
|
+
--vpc-egress=private-ranges-only \
|
|
83
|
+
--set-env-vars="MUBIT_ENDPOINT=https://api.mubit.ai,MUBIT_TRANSPORT=http,MINIMA_RECALL_MODE=agent_routed,MINIMA_LOG_LEVEL=info,MINIMA_RECOMMENDATION_STORE=cloudsql,MINIMA_RECSTORE_BACKEND=redis,MINIMA_REASONER_PROVIDER=gemini,MINIMA_REASONER_MODEL=gemini-3.5-flash" \
|
|
84
|
+
--set-secrets="GEMINI_API_KEY=minima-staging-gemini-key:latest,ANTHROPIC_API_KEY=minima-staging-anthropic-key:latest,OPENROUTER_API_KEY=minima-staging-openrouter-key:latest,MINIMA_DATABASE_URL=minima-staging-db-url:latest,MINIMA_REDIS_URL=minima-staging-redis-url:latest" \
|
|
85
|
+
--quiet
|
|
86
|
+
|
|
87
|
+
- name: Print service URL
|
|
88
|
+
run: |
|
|
89
|
+
URL=$(gcloud run services describe ${{ env.SERVICE_NAME }} \
|
|
90
|
+
--region ${{ env.REGION }} \
|
|
91
|
+
--format 'value(status.url)')
|
|
92
|
+
echo "::notice::Minima service (staging) deployed to: $URL"
|
|
93
|
+
|
|
94
|
+
# ── 2. Docs site ────────────────────────────────────────────────────────────
|
|
95
|
+
deploy-docs:
|
|
96
|
+
name: Docs → Cloud Run (staging)
|
|
97
|
+
runs-on: ubuntu-latest
|
|
98
|
+
|
|
99
|
+
steps:
|
|
100
|
+
- name: Checkout
|
|
101
|
+
uses: actions/checkout@v5
|
|
102
|
+
|
|
103
|
+
- name: Authenticate to GCP
|
|
104
|
+
uses: google-github-actions/auth@v2
|
|
105
|
+
with:
|
|
106
|
+
project_id: ${{ env.PROJECT }}
|
|
107
|
+
workload_identity_provider: ${{ secrets.GCP_WIF_PROVIDER }}
|
|
108
|
+
service_account: ${{ secrets.GCP_DEPLOYER_SA }}
|
|
109
|
+
|
|
110
|
+
- name: Configure Docker for Artifact Registry
|
|
111
|
+
run: gcloud auth configure-docker ${{ env.REGION }}-docker.pkg.dev --quiet
|
|
112
|
+
|
|
113
|
+
- name: Set up Docker Buildx
|
|
114
|
+
uses: docker/setup-buildx-action@v3
|
|
115
|
+
|
|
116
|
+
- name: Build and push docs image
|
|
117
|
+
uses: docker/build-push-action@v6
|
|
118
|
+
with:
|
|
119
|
+
context: ./docs-site
|
|
120
|
+
file: ./docs-site/Dockerfile
|
|
121
|
+
push: true
|
|
122
|
+
tags: |
|
|
123
|
+
${{ env.REGISTRY }}/minima-docs:${{ env.IMAGE_TAG }}
|
|
124
|
+
${{ env.REGISTRY }}/minima-docs:staging-latest
|
|
125
|
+
cache-from: type=gha,scope=minima-docs-staging
|
|
126
|
+
cache-to: type=gha,mode=max,scope=minima-docs-staging
|
|
127
|
+
|
|
128
|
+
- name: Deploy docs to Cloud Run (staging)
|
|
129
|
+
run: |
|
|
130
|
+
gcloud run deploy ${{ env.DOCS_SERVICE }} \
|
|
131
|
+
--image ${{ env.REGISTRY }}/minima-docs:${{ env.IMAGE_TAG }} \
|
|
132
|
+
--region ${{ env.REGION }} \
|
|
133
|
+
--platform managed \
|
|
134
|
+
--port 8080 \
|
|
135
|
+
--cpu 1 \
|
|
136
|
+
--memory 256Mi \
|
|
137
|
+
--min-instances 0 \
|
|
138
|
+
--max-instances 3 \
|
|
139
|
+
--allow-unauthenticated \
|
|
140
|
+
--service-account ${{ secrets.GCP_DEPLOYER_SA }} \
|
|
141
|
+
--quiet
|
|
142
|
+
|
|
143
|
+
- name: Print docs URL
|
|
144
|
+
run: |
|
|
145
|
+
URL=$(gcloud run services describe ${{ env.DOCS_SERVICE }} \
|
|
146
|
+
--region ${{ env.REGION }} \
|
|
147
|
+
--format 'value(status.url)')
|
|
148
|
+
echo "::notice::Minima docs (staging) deployed to: $URL"
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
__pycache__/
|
|
2
|
+
*.py[cod]
|
|
3
|
+
.venv/
|
|
4
|
+
.env
|
|
5
|
+
.env.*
|
|
6
|
+
!.env.example
|
|
7
|
+
.pytest_cache/
|
|
8
|
+
.mypy_cache/
|
|
9
|
+
.ruff_cache/
|
|
10
|
+
*.egg-info/
|
|
11
|
+
dist/
|
|
12
|
+
build/
|
|
13
|
+
.minima_state/
|
|
14
|
+
.seed_progress.json
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
# Astro docs site
|
|
18
|
+
docs-site/node_modules/
|
|
19
|
+
docs-site/.astro/
|
|
20
|
+
docs-site/dist/
|
|
21
|
+
|
|
22
|
+
# PLAN
|
|
23
|
+
docs/PLAN/
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# AGENTS.md
|
|
2
|
+
|
|
3
|
+
Guidance for both human and AI agents working in this repo.
|
|
4
|
+
|
|
5
|
+
## What this repo is
|
|
6
|
+
|
|
7
|
+
- **`src/minima/`** — Minima: a recommend-only LLM cost-optimization service (FastAPI,
|
|
8
|
+
Python 3.11+). It does NOT proxy LLM calls. It tells you which model to run, you run
|
|
9
|
+
it, judge quality, and feed the outcome back via `POST /v1/feedback` so its Mubit
|
|
10
|
+
memory sharpens. See `docs/concepts.md` for the algorithm.
|
|
11
|
+
- **`client_sdk/minima_client/`** — bundled sync + async Python client (`AsyncMinimaClient`
|
|
12
|
+
is what the harness uses). Ships inside the same wheel.
|
|
13
|
+
- **`src/minima_harness/`** — a lean Python port of `@earendil-works/pi`'s agent harness
|
|
14
|
+
(`pi-ai` + `pi-agent-core`), made Minima-native. See its `LICENSE_PI`.
|
|
15
|
+
|
|
16
|
+
## The Minima loop (always respect this)
|
|
17
|
+
|
|
18
|
+
```
|
|
19
|
+
recommend -> run the model yourself -> judge quality -> feedback
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
Minima never runs the model. Any harness owns model dispatch + quality judging. Feedback
|
|
23
|
+
MUST include realized `input_tokens` / `output_tokens` / `actual_cost_usd` / `latency_ms`
|
|
24
|
+
so the cost basis can climb `estimate -> observed -> rescaled` (the biggest accuracy
|
|
25
|
+
lever). Outcome thresholds: `success >= 0.8`, `partial >= 0.4`, else `failure`.
|
|
26
|
+
|
|
27
|
+
## Conventions
|
|
28
|
+
|
|
29
|
+
- `from __future__ import annotations` at the top of every module.
|
|
30
|
+
- Pydantic v2 `BaseModel` for serializable schemas; `@dataclass(slots=True)` for internal
|
|
31
|
+
types; `StrEnum` for enums; `Protocol` for seams (`Memory`, `Reasoner`, `Provider`).
|
|
32
|
+
- Async-first. Bridge sync SDKs (Mubit) off the event loop via `anyio`/threadpools.
|
|
33
|
+
- `structlog` via `get_logger("minima.<sub>")`.
|
|
34
|
+
- ruff `line-length=100`, mypy `py311`. Never break the hot path: bookkeeping failures are
|
|
35
|
+
logged-and-swallowed (`except Exception: # noqa: BLE001`).
|
|
36
|
+
- NO comments unless asked. Match existing style.
|
|
37
|
+
|
|
38
|
+
## Commands
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
uv sync --extra dev # install (uv is the package manager)
|
|
42
|
+
uv run ruff check . && uv run ruff format . # lint + format
|
|
43
|
+
uv run mypy src/minima src/minima_harness # typecheck
|
|
44
|
+
uv run pytest # unit + integration (hermetic, offline)
|
|
45
|
+
uv run pytest -m live # needs a running Mubit (make run-mubit)
|
|
46
|
+
uv run pytest tests/harness # harness-only smoke
|
|
47
|
+
make run # local Minima on :8080 (harness dev target)
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Offline tests MUST stay hermetic: the `conftest.py` autouse fixture neutralizes `.env`.
|
|
51
|
+
Use `tests/factories.py:FakeMemory` + `create_app(...)` + `TestClient` for in-process
|
|
52
|
+
tests without Mubit. For the harness, the faux provider
|
|
53
|
+
(`minima_harness.ai.providers.register_faux_provider`) gives hermetic LLM calls.
|
|
54
|
+
|
|
55
|
+
## minima_harness build roadmap
|
|
56
|
+
|
|
57
|
+
Phases are independently verifiable; do not skip the verify step.
|
|
58
|
+
|
|
59
|
+
- **Phase 0 (done)** — scaffold: `ai/` types, registry, tools, usage, stream dispatcher,
|
|
60
|
+
faux provider; `minima/config.py`; `tasks/` corpus; AGENTS.md; pyproject wiring.
|
|
61
|
+
- **Phase 1 (done)** — ported `pi-ai`: real providers (`anthropic`, `google`,
|
|
62
|
+
`openai_compat` via raw httpx) registering into the provider registry (lazy, SDK
|
|
63
|
+
optional); cross-provider compat (`ai/compat.py`). Tests: faux + hermetic SSE/SDK
|
|
64
|
+
mapping + `-m live`.
|
|
65
|
+
- **Phase 2 (done)** — ported `pi-agent-core`: `Agent` + `agent_loop` async generator,
|
|
66
|
+
events, tool execution loop (parallel via anyio), beforeToolCall/afterToolCall hooks,
|
|
67
|
+
steering/follow-up, abort, max_turns guard.
|
|
68
|
+
- **Phase 3 (done)** — Minima integration: `minima/router.py` (recommend->set model,
|
|
69
|
+
feedback), `minima/mapping.py` (model_id <-> Model), `minima/judge.py`
|
|
70
|
+
(`QualityJudge` Protocol + `LLMJudge`/`DeterministicJudge`/`ConstJudge`),
|
|
71
|
+
`minima/runtime.py` (`MinimaAgent`). Hermetic via FakeMemory+ASGI app; live test.
|
|
72
|
+
- **Phase 4 (done)** — `examples/harness_warmup.py` (demo + live modes),
|
|
73
|
+
`docs/harness.md`, README + examples/README sections.
|
|
74
|
+
- **Phase A (done)** — cost observability: `RoutingResult` carries Minima's full ranked/
|
|
75
|
+
rationale/warnings payload + `baseline_cost_usd`; `CostMeter`; `before_route`
|
|
76
|
+
override/veto hook.
|
|
77
|
+
- **Phase B (done)** — code-quality-aware routing: `CodeHealthExtractor` +
|
|
78
|
+
`ContextExtractor` protocol; `tags`/`difficulty`/`expected_input_tokens` from touched
|
|
79
|
+
files flow into `recommend()` via `prompt(files=...)`, with a discrimination gate.
|
|
80
|
+
- **Phase C (done)** — token yield: `turns_taken` per prompt → `feedback(iterations=)` →
|
|
81
|
+
`FeedbackRequest`/`OutcomeRecord` gain a backward-compatible `iterations` field.
|
|
82
|
+
|
|
83
|
+
## Hard rules
|
|
84
|
+
|
|
85
|
+
- Do NOT add the `openai` SDK as a dependency — the OpenAI-compatible provider uses raw
|
|
86
|
+
`httpx` (matches PI's fetch approach; keeps deps lean). Reuse minima's existing
|
|
87
|
+
optional extras (`anthropic`, `google-genai`) for those providers.
|
|
88
|
+
- Routing must be bypassable (`minima=None`) so the agent runtime works without Minima.
|
|
89
|
+
- Keep PI's wire discriminator values (`type: "toolCall"`, `role`, `stopReason`) so the
|
|
90
|
+
shapes stay recognizable; snake_case the field names.
|