chimera-deliberation 0.1.0__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.
Files changed (68) hide show
  1. chimera_deliberation-0.1.0/.github/workflows/ci.yml +81 -0
  2. chimera_deliberation-0.1.0/.gitignore +12 -0
  3. chimera_deliberation-0.1.0/.gitreins/config.yaml +39 -0
  4. chimera_deliberation-0.1.0/.memory-bank/active-context.md +37 -0
  5. chimera_deliberation-0.1.0/.memory-bank/product-context.md +19 -0
  6. chimera_deliberation-0.1.0/.memory-bank/progress.md +19 -0
  7. chimera_deliberation-0.1.0/.memory-bank/project-brief.md +27 -0
  8. chimera_deliberation-0.1.0/.memory-bank/system-patterns.md +24 -0
  9. chimera_deliberation-0.1.0/.memory-bank/tech-context.md +29 -0
  10. chimera_deliberation-0.1.0/PKG-INFO +33 -0
  11. chimera_deliberation-0.1.0/README.md +212 -0
  12. chimera_deliberation-0.1.0/bin/chimera-mcp-hermes +3 -0
  13. chimera_deliberation-0.1.0/bin/chimera-mcp-wrapper +4 -0
  14. chimera_deliberation-0.1.0/chimera.yaml.example +190 -0
  15. chimera_deliberation-0.1.0/docs/CONFIG.md +237 -0
  16. chimera_deliberation-0.1.0/docs/EDGE_CASES.md +83 -0
  17. chimera_deliberation-0.1.0/docs/FAILURE_RESILIENCE.md +92 -0
  18. chimera_deliberation-0.1.0/docs/OPENAI_API.md +225 -0
  19. chimera_deliberation-0.1.0/docs/RESILIENCE.md +81 -0
  20. chimera_deliberation-0.1.0/docs/SECURITY.md +138 -0
  21. chimera_deliberation-0.1.0/docs/USAGE.md +238 -0
  22. chimera_deliberation-0.1.0/pyproject.toml +55 -0
  23. chimera_deliberation-0.1.0/scripts/compat-smoke.sh +35 -0
  24. chimera_deliberation-0.1.0/specs/architecture.md +344 -0
  25. chimera_deliberation-0.1.0/src/chimera/__init__.py +56 -0
  26. chimera_deliberation-0.1.0/src/chimera/aggregator.py +174 -0
  27. chimera_deliberation-0.1.0/src/chimera/api/__init__.py +1 -0
  28. chimera_deliberation-0.1.0/src/chimera/api/dependencies.py +84 -0
  29. chimera_deliberation-0.1.0/src/chimera/api/rate_limit.py +115 -0
  30. chimera_deliberation-0.1.0/src/chimera/api/server.py +516 -0
  31. chimera_deliberation-0.1.0/src/chimera/circuit_breaker.py +149 -0
  32. chimera_deliberation-0.1.0/src/chimera/cli/__init__.py +1 -0
  33. chimera_deliberation-0.1.0/src/chimera/cli/main.py +250 -0
  34. chimera_deliberation-0.1.0/src/chimera/config.py +289 -0
  35. chimera_deliberation-0.1.0/src/chimera/dispatcher.py +765 -0
  36. chimera_deliberation-0.1.0/src/chimera/engine.py +601 -0
  37. chimera_deliberation-0.1.0/src/chimera/exceptions.py +23 -0
  38. chimera_deliberation-0.1.0/src/chimera/gateway.py +591 -0
  39. chimera_deliberation-0.1.0/src/chimera/mcp/__init__.py +1 -0
  40. chimera_deliberation-0.1.0/src/chimera/mcp/server.py +108 -0
  41. chimera_deliberation-0.1.0/src/chimera/observability.py +99 -0
  42. chimera_deliberation-0.1.0/tests/__init__.py +0 -0
  43. chimera_deliberation-0.1.0/tests/compat/__init__.py +1 -0
  44. chimera_deliberation-0.1.0/tests/compat/conftest.py +116 -0
  45. chimera_deliberation-0.1.0/tests/compat/test_models.py +135 -0
  46. chimera_deliberation-0.1.0/tests/conftest.py +182 -0
  47. chimera_deliberation-0.1.0/tests/integration/__init__.py +0 -0
  48. chimera_deliberation-0.1.0/tests/integration/conftest.py +288 -0
  49. chimera_deliberation-0.1.0/tests/integration/test_api_surface.py +144 -0
  50. chimera_deliberation-0.1.0/tests/integration/test_e2e_deliberation.py +129 -0
  51. chimera_deliberation-0.1.0/tests/integration/test_error_paths.py +211 -0
  52. chimera_deliberation-0.1.0/tests/integration/test_structured_output.py +123 -0
  53. chimera_deliberation-0.1.0/tests/test_aggregator.py +92 -0
  54. chimera_deliberation-0.1.0/tests/test_api.py +207 -0
  55. chimera_deliberation-0.1.0/tests/test_cli.py +88 -0
  56. chimera_deliberation-0.1.0/tests/test_concurrency.py +355 -0
  57. chimera_deliberation-0.1.0/tests/test_config.py +177 -0
  58. chimera_deliberation-0.1.0/tests/test_dispatcher.py +614 -0
  59. chimera_deliberation-0.1.0/tests/test_e2e.py +112 -0
  60. chimera_deliberation-0.1.0/tests/test_engine.py +516 -0
  61. chimera_deliberation-0.1.0/tests/test_gateway.py +264 -0
  62. chimera_deliberation-0.1.0/tests/test_gateway_coverage.py +727 -0
  63. chimera_deliberation-0.1.0/tests/test_init.py +95 -0
  64. chimera_deliberation-0.1.0/tests/test_mcp.py +74 -0
  65. chimera_deliberation-0.1.0/tests/test_observability.py +32 -0
  66. chimera_deliberation-0.1.0/tests/test_rate_limit_coverage.py +111 -0
  67. chimera_deliberation-0.1.0/tests/test_security.py +457 -0
  68. chimera_deliberation-0.1.0/tests/test_server_coverage.py +507 -0
@@ -0,0 +1,81 @@
1
+ name: CI
2
+
3
+ on:
4
+ push:
5
+ branches: [main]
6
+ pull_request:
7
+ branches: [main]
8
+ schedule:
9
+ - cron: "0 6 * * *" # daily at 6am UTC
10
+
11
+ jobs:
12
+ lint:
13
+ runs-on: ubuntu-latest
14
+ continue-on-error: true # Non-blocking: advisory lint (matches pre-commit hook)
15
+ steps:
16
+ - uses: actions/checkout@v4
17
+
18
+ - name: Set up Python
19
+ uses: actions/setup-python@v5
20
+ with:
21
+ python-version: "3.11"
22
+
23
+ - name: Create venv and install ruff
24
+ run: |
25
+ python -m venv .venv
26
+ .venv/bin/pip install ruff>=0.6.0
27
+
28
+ - name: Run ruff
29
+ run: .venv/bin/ruff check .
30
+
31
+ test:
32
+ runs-on: ubuntu-latest
33
+ strategy:
34
+ matrix:
35
+ python-version: ["3.11", "3.12", "3.13"]
36
+ fail-fast: false
37
+ steps:
38
+ - uses: actions/checkout@v4
39
+
40
+ - name: Set up Python ${{ matrix.python-version }}
41
+ uses: actions/setup-python@v5
42
+ with:
43
+ python-version: ${{ matrix.python-version }}
44
+
45
+ - name: Create venv and install project
46
+ run: |
47
+ python -m venv .venv
48
+ .venv/bin/pip install --upgrade pip
49
+ .venv/bin/pip install -e ".[full]"
50
+
51
+ - name: Run tests
52
+ run: .venv/bin/python -m pytest tests/ -q
53
+
54
+ - name: Report test count
55
+ if: always()
56
+ run: |
57
+ .venv/bin/python -m pytest tests/ --collect-only -q 2>&1 | tail -5
58
+
59
+ publish:
60
+ needs: [lint, test]
61
+ runs-on: ubuntu-latest
62
+ if: github.event_name == 'push' && github.ref == 'refs/heads/main'
63
+ steps:
64
+ - uses: actions/checkout@v4
65
+
66
+ - name: Set up Python
67
+ uses: actions/setup-python@v5
68
+ with:
69
+ python-version: "3.11"
70
+
71
+ - name: Build package
72
+ run: |
73
+ python -m venv .venv
74
+ .venv/bin/pip install build twine
75
+ .venv/bin/python -m build
76
+
77
+ - name: Publish to PyPI
78
+ run: .venv/bin/twine upload dist/*
79
+ env:
80
+ TWINE_USERNAME: __token__
81
+ TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }}
@@ -0,0 +1,12 @@
1
+ __pycache__/
2
+ *.pyc
3
+ .venv/
4
+ dist/
5
+ *.egg-info/
6
+ chimera.yaml
7
+ .env
8
+ .pytest_cache/
9
+ .ruff_cache/
10
+ mutants/
11
+ .coverage
12
+ htmlcov/
@@ -0,0 +1,39 @@
1
+ # GitReins Configuration — Chimera
2
+
3
+ guards:
4
+ secrets: true
5
+ lint: true
6
+ tests: true
7
+ test_command: "pytest -x --tb=short -q"
8
+
9
+ pipeline:
10
+ stages:
11
+ - id: tier1
12
+ parallel: true
13
+ on: [pre-commit, pre-eval]
14
+ steps:
15
+ - id: secrets
16
+ type: script
17
+ run: "bash .git/hooks/pre-commit-secrets"
18
+ on_fail: block
19
+
20
+ - id: lint
21
+ type: script
22
+ run: "ruff check src/ tests/ --quiet"
23
+ on_fail: continue
24
+
25
+ - id: tests
26
+ type: script
27
+ run: "pytest -x --tb=short -q"
28
+ on_fail: continue
29
+
30
+ - id: tier2
31
+ type: ai_eval
32
+ on: [pre-eval]
33
+ condition: "true"
34
+ max_iterations: 20
35
+ tools: [read_file, run_command, search_pattern, read_diff, sandbox]
36
+
37
+ evaluator:
38
+ max_iterations: 20
39
+ model: deepseek-chat
@@ -0,0 +1,37 @@
1
+ # Active Context — Chimera
2
+
3
+ ## Current Phase
4
+ **Phase 0: Architecture & Scaffolding** (June 17, 2026)
5
+
6
+ ## What We're Building
7
+ Fresh implementation of Chimera v2 — dispatcher-first architecture with
8
+ category-weighted domain routing, dynamic DAG formations, and dispatcher-written
9
+ judge instructions.
10
+
11
+ ## Key Decisions
12
+ - **No SpecLang** — clean Python project, no code generation pipeline
13
+ - **OpenCode + GLM-5.2** as the build agent (Z.AI subscription, no OpenRouter fees)
14
+ - **Memory bank pattern** from Axiom/Conscience projects
15
+ - **Config-driven from day one** — no hardcoded model assignments
16
+ - **Budget-first defaults** — DeepSeek V4 for dispatcher/worker/judge
17
+ - **Request-level overrides** — API accepts allowed_models, disallowed_models,
18
+ dispatcher_model, judge_model, worker_model per request
19
+
20
+ ## Model Strategy
21
+ - **Default**: DeepSeek V4 (cheap, good all-rounder) for all roles
22
+ - **Premium options**: GLM-5.2, Claude Sonnet 4 — available via request overrides
23
+ - **Per-request control**: Caller can force specific models, whitelist/blacklist
24
+ - **Category weights**: Each model scored 0.0–1.0 per domain (code, analysis, design, audit, reasoning)
25
+ - **Dispatcher uses weights** to auto-assign models when not overridden
26
+
27
+ ## Blockers
28
+ None.
29
+
30
+ ## Next Steps
31
+ 1. ✅ Architecture spec written
32
+ 2. ✅ Memory bank initialized
33
+ 3. ✅ GLM-5.2 built full implementation (3,386 lines, 65 tests)
34
+ 4. ✅ Request-level overrides added to API + config
35
+ 5. 🔄 Live E2E deliberation test (budget-first defaults)
36
+ 6. Create GitLab repo and push
37
+ 7. MCP integration test with Hermes
@@ -0,0 +1,19 @@
1
+ # Product Context — Chimera
2
+
3
+ ## User Experience
4
+ 1. User sends a prompt: "Design a scalable microservice architecture for an e-commerce platform"
5
+ 2. Chimera's dispatcher analyzes it — touches design, backend, analysis domains
6
+ 3. Dispatcher picks Gemini (strong at design) for architecture design, DeepSeek (strong at code) for service boundaries, Claude (strong at analysis) for trade-off analysis
7
+ 4. Each gets a custom prompt scoped to their subtask
8
+ 5. Judge merges: "Here's the architecture, here are the service boundaries, here are the trade-offs"
9
+
10
+ ## Stakeholders
11
+ - **Bane (totalwindupflightsystems)** — primary user, drives design
12
+ - **Hermes Agent** — dispatches Chimera stages via MCP
13
+ - **Any AI coding agent** — drop-in OpenAI-compatible endpoint
14
+
15
+ ## Non-Goals (v1)
16
+ - Streaming responses
17
+ - Tool/function calling passthrough
18
+ - Response caching
19
+ - Multi-turn conversation state
@@ -0,0 +1,19 @@
1
+ # Progress — Chimera
2
+
3
+ ## 2026-06-17
4
+
5
+ ### Phase 0: Architecture & Scaffolding
6
+ - [x] Architecture spec written (specs/architecture.md — 11KB)
7
+ - [x] Memory bank initialized (.memory-bank/)
8
+ - [x] Project scaffolding (pyproject.toml, .gitignore, README)
9
+ - [x] Config example (chimera.yaml.example)
10
+ - [ ] GLM-5.2 builds full implementation
11
+ - [ ] All tests passing
12
+ - [ ] Live deliberation smoke test
13
+ - [ ] GitLab repo created and pushed
14
+
15
+ ## Validation Gate
16
+ ```bash
17
+ cd ~/chimera-v2
18
+ python -m pytest tests/ -x -q && echo "PASS" || echo "FAIL"
19
+ ```
@@ -0,0 +1,27 @@
1
+ # Project Brief — Chimera
2
+
3
+ ## What
4
+ A dynamic multi-model deliberation gateway. Takes a user prompt, designs a custom
5
+ formation of models to solve it, and returns a merged answer.
6
+
7
+ ## Why
8
+ OpenRouter Fusion runs a fixed panel of models with the same prompt. Chimera's
9
+ dispatcher analyzes the task, picks the best models by category-weighted domain
10
+ strength, writes custom prompts for each worker, and tells the judge how to merge.
11
+
12
+ This makes weak models useful: a model bad at code but good at design gets
13
+ design-only subtasks. Budget models handle simple pieces, premium models do
14
+ complex work.
15
+
16
+ ## Core Principle
17
+ **One model (Dispatcher) designs the entire deliberation in one shot.**
18
+ It reads the user prompt + model catalog → designs formation DAG → writes all
19
+ worker prompts + judge instructions simultaneously.
20
+
21
+ ## Success Criteria
22
+ - OpenAI-compatible `/v1/chat/completions` endpoint (drop-in replacement)
23
+ - Full deliberation completes with correct merged output
24
+ - Category-weighted domain routing works (right model for right subtask)
25
+ - Dispatcher-written judge instructions produce quality merges
26
+ - Traceability: every stage logged (prompt, response, tokens, cost)
27
+ - Config-driven: add models via YAML with category weights
@@ -0,0 +1,24 @@
1
+ # System Patterns — Chimera
2
+
3
+ ## Dispatcher-First Architecture
4
+ All intelligence lives in the dispatcher. Workers and judges are "dumb" executors
5
+ following dispatcher-written instructions. The dispatcher reads the config (model
6
+ catalog with category weights) and designs the entire formation.
7
+
8
+ ## Category-Weighted Domain Routing
9
+ Models have weighted scores per category (code, analysis, design, audit).
10
+ Like bandwidth provider weighting — this model in this category has this weight.
11
+ The dispatcher uses these to assign tasks.
12
+
13
+ ## DAG Formations
14
+ Not just linear. Dispatcher can design fan-out → process → fan-in → judge,
15
+ multi-judge with merge, audit stages, whatever the task requires.
16
+
17
+ ## Provider Gateway
18
+ Abstracts model providers behind a uniform interface. Supports OpenRouter,
19
+ direct provider APIs (z-ai, anthropic, deepseek, openai). LiteLLM for protocol
20
+ translation.
21
+
22
+ ## Observability
23
+ Every stage logged: prompt, response, model, tokens, cost, latency.
24
+ Optional Langfuse integration for production tracing.
@@ -0,0 +1,29 @@
1
+ # Tech Context — Chimera
2
+
3
+ ## Language
4
+ Python 3.11+ with full type hints. Pydantic v2 for all data models.
5
+
6
+ ## Key Dependencies
7
+ - **LiteLLM** — provider gateway (OpenRouter, direct APIs)
8
+ - **FastAPI** — REST API server
9
+ - **Click + Rich** — CLI
10
+ - **MCP SDK** — Hermes integration
11
+ - **Pydantic v2** — data validation
12
+ - **structlog** — structured JSON logging
13
+ - **httpx** — async HTTP client
14
+ - **pytest + pytest-asyncio** — testing
15
+
16
+ ## Packaging
17
+ pipx with extras: `chimera[cli]`, `chimera[server]`, `chimera[mcp]`, `chimera[full]`
18
+
19
+ ## Testing
20
+ `python -m pytest tests/ -x -q` — must pass before any commit.
21
+
22
+ ## Config
23
+ Single `chimera.yaml` — model catalog, provider settings, formation presets,
24
+ observability config. API keys via env vars or config file (config file is
25
+ in .gitignore).
26
+
27
+ ## Logging
28
+ structlog → stderr (JSON). trace_enabled logs full prompts/responses.
29
+ Langfuse optional for production.
@@ -0,0 +1,33 @@
1
+ Metadata-Version: 2.4
2
+ Name: chimera-deliberation
3
+ Version: 0.1.0
4
+ Summary: Dynamic multi-model deliberation gateway
5
+ Requires-Python: >=3.11
6
+ Requires-Dist: httpx>=0.27.0
7
+ Requires-Dist: litellm>=1.50.0
8
+ Requires-Dist: pydantic>=2.0
9
+ Requires-Dist: pyyaml>=6.0
10
+ Requires-Dist: structlog>=24.0
11
+ Provides-Extra: cli
12
+ Requires-Dist: click>=8.0; extra == 'cli'
13
+ Requires-Dist: rich>=13.0; extra == 'cli'
14
+ Provides-Extra: dev
15
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'dev'
16
+ Requires-Dist: pytest-cov>=5.0; extra == 'dev'
17
+ Requires-Dist: pytest>=8.0; extra == 'dev'
18
+ Requires-Dist: ruff>=0.6.0; extra == 'dev'
19
+ Provides-Extra: full
20
+ Requires-Dist: click>=8.0; extra == 'full'
21
+ Requires-Dist: fastapi>=0.115.0; extra == 'full'
22
+ Requires-Dist: mcp>=1.0.0; extra == 'full'
23
+ Requires-Dist: pytest-asyncio>=0.24.0; extra == 'full'
24
+ Requires-Dist: pytest-cov>=5.0; extra == 'full'
25
+ Requires-Dist: pytest>=8.0; extra == 'full'
26
+ Requires-Dist: rich>=13.0; extra == 'full'
27
+ Requires-Dist: ruff>=0.6.0; extra == 'full'
28
+ Requires-Dist: uvicorn[standard]>=0.30.0; extra == 'full'
29
+ Provides-Extra: mcp
30
+ Requires-Dist: mcp>=1.0.0; extra == 'mcp'
31
+ Provides-Extra: server
32
+ Requires-Dist: fastapi>=0.115.0; extra == 'server'
33
+ Requires-Dist: uvicorn[standard]>=0.30.0; extra == 'server'
@@ -0,0 +1,212 @@
1
+ # Chimera — Dynamic Multi-Model Deliberation Gateway
2
+
3
+ [![CI](https://github.com/totalwindupflightsystems/chimera/actions/workflows/ci.yml/badge.svg)](https://github.com/totalwindupflightsystems/chimera/actions/workflows/ci.yml)
4
+
5
+ One API call. A team of models. One answer.
6
+
7
+ Chimera takes your prompt, dispatches it to a hand-picked team of LLMs (each with
8
+ a custom subtask scoped to their strengths), and an aggregator merges their outputs
9
+ using dispatcher-written instructions. One dispatcher model call designs the entire
10
+ deliberation at once.
11
+
12
+ ## Architecture
13
+
14
+ ```mermaid
15
+ flowchart TB
16
+ subgraph Client
17
+ A[User Prompt]
18
+ end
19
+
20
+ subgraph Dispatcher["Dispatcher (1 call)"]
21
+ B[Designs DAG<br/>Picks models by category<br/>Writes custom prompts<br/>Writes merge instructions]
22
+ end
23
+
24
+ subgraph Workers["Workers (parallel)"]
25
+ C1[Worker A<br/>domain-scoped task]
26
+ C2[Worker B<br/>domain-scoped task]
27
+ C3[Worker C<br/>domain-scoped task]
28
+ end
29
+
30
+ subgraph Aggregation
31
+ D[Aggregator<br/>merges with dispatcher instructions]
32
+ end
33
+
34
+ A --> B
35
+ B --> C1
36
+ B --> C2
37
+ B --> C3
38
+ C1 --> D
39
+ C2 --> D
40
+ C3 --> D
41
+ D --> E[Final Answer]
42
+ ```
43
+
44
+ ## Formation Types
45
+
46
+ ```mermaid
47
+ flowchart LR
48
+ subgraph Simple["Simple (2 workers)"]
49
+ S1[W1] --> SA[Aggregator]
50
+ S2[W2] --> SA
51
+ end
52
+
53
+ subgraph Debate["Debate (3 workers + merge)"]
54
+ D1[W1] --> DA1[Agg 1]
55
+ D2[W2] --> DA1
56
+ D2 --> DA2[Agg 2]
57
+ D3[W3] --> DA2
58
+ DA1 --> DM[Merge]
59
+ DA2 --> DM
60
+ end
61
+
62
+ subgraph Custom["Custom DAG (client-defined)"]
63
+ C1[Researcher] --> C2[Critic]
64
+ C2 --> C3[Polisher]
65
+ C3 --> C4[Final]
66
+ end
67
+ ```
68
+
69
+ ## Flow: Request to Answer
70
+
71
+ ```mermaid
72
+ sequenceDiagram
73
+ participant Client
74
+ participant Engine
75
+ participant Dispatcher
76
+ participant Workers
77
+ participant Aggregator
78
+
79
+ Client->>Engine: POST /v1/chat/completions
80
+ Engine->>Dispatcher: Design formation
81
+ Dispatcher->>Dispatcher: Pick models by category weights
82
+ Dispatcher->>Dispatcher: Write per-worker prompts + merge instructions
83
+ Dispatcher-->>Engine: DAG + prompts + instructions
84
+
85
+ par Workers (parallel)
86
+ Engine->>Workers: Worker A (custom prompt)
87
+ Engine->>Workers: Worker B (custom prompt)
88
+ Engine->>Workers: Worker C (custom prompt)
89
+ Workers-->>Engine: responses
90
+ end
91
+
92
+ Engine->>Aggregator: Merge with dispatcher instructions
93
+ Aggregator-->>Engine: Final answer
94
+
95
+ Engine-->>Client: JSON response + trace
96
+ ```
97
+
98
+ ## Quick Start
99
+
100
+ ```bash
101
+ # Install
102
+ pipx install chimera[full]
103
+
104
+ # Configure
105
+ cp chimera.yaml.example chimera.yaml
106
+ # Edit chimera.yaml with your API keys
107
+
108
+ # Run
109
+ chimera deliberate "Compare React, Vue, and Svelte for a real-time dashboard"
110
+
111
+ # Or as an API server
112
+ chimera serve
113
+ # → http://localhost:8000/v1/chat/completions (OpenAI-compatible)
114
+ # → http://localhost:8000/docs (OpenAPI docs)
115
+
116
+ # Or as MCP server for Hermes/AI agents
117
+ chimera-mcp
118
+ ```
119
+
120
+ ## Model Selection
121
+
122
+ The dispatcher picks models using **category-weighted scoring**:
123
+
124
+ | Category | What it measures |
125
+ |---|---|
126
+ | `code` | Programming, debugging, software engineering |
127
+ | `analysis` | Data analysis, research, evaluation |
128
+ | `reasoning` | Logic, math, complex problem-solving |
129
+ | `design` | Creative work, UX, content generation |
130
+ | `audit` | Fact-checking, safety, correctness review |
131
+
132
+ Each model in the catalog has a score (0.0–1.0) per category. The dispatcher matches
133
+ task domains to model strengths. You can override any model choice per request:
134
+
135
+ ```json
136
+ {
137
+ "model": "auto",
138
+ "messages": [{"role": "user", "content": "..."}],
139
+ "dispatcher_model": "deepseek/deepseek-v4-flash",
140
+ "allowed_models": ["deepseek/deepseek-v4-pro", "z-ai/glm-5.2"],
141
+ "stage_models": {"worker_1": "openrouter/anthropic/claude-sonnet-4"}
142
+ }
143
+ ```
144
+
145
+ ## Custom DAGs
146
+
147
+ Send your own formation structure at request time:
148
+
149
+ ```json
150
+ {
151
+ "model": "custom",
152
+ "allow_custom_dag": true,
153
+ "dag": {
154
+ "stages": [
155
+ {"id": "researcher", "kind": "worker", "model": "openrouter/anthropic/claude-sonnet-4"},
156
+ {"id": "critic", "kind": "aggregator", "model": "z-ai/glm-5.2", "depends_on": ["researcher"]},
157
+ {"id": "polisher", "kind": "worker", "model": "deepseek/deepseek-v4-pro", "depends_on": ["critic"]},
158
+ {"id": "final", "kind": "aggregator", "model": "openrouter/anthropic/claude-sonnet-4", "depends_on": ["polisher"]}
159
+ ],
160
+ "edges": [["researcher","critic"], ["critic","polisher"], ["polisher","final"]]
161
+ },
162
+ "messages": [{"role": "user", "content": "..."}]
163
+ }
164
+ ```
165
+
166
+ The dispatcher writes custom prompts for each stage but uses YOUR structure exactly.
167
+
168
+ ## Interfaces
169
+
170
+ | Interface | Endpoint | Use |
171
+ |---|---|---|
172
+ | **REST API** | `POST /v1/chat/completions` | OpenAI-compatible drop-in |
173
+ | **REST API** | `POST /v1/deliberate` | Full control (DAG, overrides, trace) |
174
+ | **REST API** | `GET /v1/models` | Model catalog with weights |
175
+ | **REST API** | `GET /v1/formations` | Available formation presets |
176
+ | **CLI** | `chimera deliberate` | Command-line usage |
177
+ | **MCP** | `chimera_deliberate` | Hermes / AI agent integration |
178
+
179
+ ## Response Trace
180
+
181
+ Every deliberation returns a full trace:
182
+
183
+ ```
184
+ request_id: a71b3f2c...
185
+ formation: auto
186
+ source: auto ← not "fallback" — dispatcher designed it
187
+ total_tokens: 12345
188
+ total_cost: $0.012
189
+ total_duration_ms: 15234
190
+
191
+ dispatch: V4 Flash (1,234ms, 800+420 tok)
192
+ workers:
193
+ worker_rust: Claude Sonnet 4 (4,500ms, 300+1,200 tok)
194
+ worker_go: Kimi K2.7 (8,200ms, 250+800 tok)
195
+ aggregator: V4 Flash (2,100ms, 3,000+500 tok)
196
+ ```
197
+
198
+ ## Providers
199
+
200
+ Chimera uses LiteLLM under the hood. Supported providers:
201
+
202
+ | Provider | Direct API | Via OpenRouter | Models |
203
+ |---|---|---|---|
204
+ | **DeepSeek** | ✅ | ✅ | v4-flash, v4-pro, r1 |
205
+ | **Anthropic** | — | ✅ | Sonnet 4, Opus 4.7/4.8, Haiku 4.5 |
206
+ | **OpenAI** | — | ✅ | GPT-5.5, GPT-5.1 |
207
+ | **xAI** | — | ✅ | Grok 4.20 |
208
+ | **Google** | — | ✅ | Gemini 3.5 Flash, 3.1 Pro, 2.5 Flash |
209
+ | **Z.AI** | ✅ (direct) | ✅ | GLM-5.2 |
210
+ | **MoonshotAI** | — | ✅ | Kimi K2.7 Code, K2.6 |
211
+ | **MiniMax** | — | ✅ | M3 |
212
+ | **Meta** | — | ✅ | Llama 4 Maverick |
@@ -0,0 +1,3 @@
1
+ #!/bin/bash
2
+ # Chimera MCP wrapper for Hermes
3
+ exec /home/kara/.hermes/hermes-agent/venv/bin/chimera-mcp /home/kara/chimera-v2/chimera.yaml
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+ # Chimera MCP wrapper — ensures chimera.yaml is found
3
+ cd /home/kara/chimera-v2 || exit 1
4
+ exec /home/kara/.hermes/hermes-agent/venv/bin/chimera-mcp