Skip to content
Merged
Show file tree
Hide file tree
Changes from 81 commits
Commits
Show all changes
97 commits
Select commit Hold shift + click to select a range
27afbce
feat(routing): add operator-managed model groups
seonghobae Aug 25, 2026
8118d1a
fix(api): enforce model group create semantics
seonghobae Aug 25, 2026
b1eb222
fix(routing): preserve eligibility and REST contracts
seonghobae Aug 25, 2026
6b069a0
docs(groups): remove ephemeral model example
seonghobae Aug 25, 2026
3b17ff0
fix(groups): route advertised aliases end to end
seonghobae Aug 25, 2026
f448175
ci: hourly OpenCode maintenance agent routed through this gateway (#835)
seonghobae Aug 25, 2026
b0ffb33
fix(groups): preserve internal dispatch default
seonghobae Aug 25, 2026
b1fdec6
fix: isolate model group routing evidence
seonghobae Aug 25, 2026
b498c43
fix: preserve conduct semantics for model groups
seonghobae Aug 25, 2026
356efc4
ci: minimize hourly loop permissions and installs
seonghobae Aug 25, 2026
e5b5095
fix: measure streamed group routing
seonghobae Aug 25, 2026
b353e6a
feat: route model groups across modalities (#837)
seonghobae Aug 25, 2026
fae8665
feat: normalize and edit model groups (#838)
seonghobae Aug 25, 2026
852fc1e
fix: preserve capability routing contracts
seonghobae Aug 25, 2026
19ab869
Merge pull request #839 from ContextualWisdomLab/fix/capability-routi…
seonghobae Aug 25, 2026
7c6f564
release: v0.2.0 — model groups, cost-aware discovery, changelog baseline
seonghobae Aug 25, 2026
c4896ae
fix(discovery): tolerate null modality arrays
seonghobae Aug 25, 2026
4bf5cf0
Merge pull request #841 from ContextualWisdomLab/fix/discovery-null-m…
seonghobae Aug 25, 2026
49d0940
docs: specify model group product and technical contracts
seonghobae Aug 25, 2026
4e0cbca
Merge pull request #842 from ContextualWisdomLab/docs/model-group-pro…
seonghobae Aug 25, 2026
0e6507e
Merge remote-tracking branch 'origin/feat/model-group-cost-aware-disc…
seonghobae Aug 25, 2026
fd6dde7
release: align v0.2.0 changelog and lock metadata
seonghobae Aug 25, 2026
6f49413
Merge pull request #840 from ContextualWisdomLab/release/v0.2.0-model…
seonghobae Aug 25, 2026
bc89d61
Merge remote-tracking branch 'origin/main' into stack-834
seonghobae Aug 25, 2026
43717d3
feat: stream orchestrated reasoning summaries
seonghobae Aug 25, 2026
5970a4d
Merge remote-tracking branch 'origin/feat/model-group-cost-aware-disc…
seonghobae Aug 25, 2026
5cde1ae
fix: keep free reasoning streams fail closed
seonghobae Aug 25, 2026
99ee64d
Merge remote-tracking branch 'origin/main' into feat/model-group-cost…
seonghobae Aug 25, 2026
8df2bfb
fix: preserve free routing evidence and analytics
seonghobae Aug 25, 2026
4f1e597
fix: distinguish failed Responses streams in analytics
seonghobae Aug 25, 2026
2cc49b0
fix: pin structured free judge to selected agent
seonghobae Aug 25, 2026
1fd7493
Merge branch 'feat/model-group-cost-aware-discovery' of https://githu…
seonghobae Aug 25, 2026
34f77ec
Merge remote-tracking branch 'origin/main' into stack834b
seonghobae Aug 25, 2026
ee8ff16
fix: lock container dependencies and virtual capabilities
seonghobae Aug 25, 2026
a0d5552
fix: keep free passthrough on zero-cost models
seonghobae Aug 25, 2026
8208f39
fix: prune removed routing measurements
seonghobae Aug 25, 2026
c262b8d
refactor: remove unreachable responses passthrough branch
seonghobae Aug 25, 2026
e38e959
fix: route virtual models across media capabilities
seonghobae Aug 25, 2026
18b5890
Merge remote-tracking branch 'origin/feat/model-group-cost-aware-disc…
seonghobae Aug 25, 2026
fd5fa8c
fix: retain reset candidate routing rows
seonghobae Aug 25, 2026
fefd6e0
fix: preserve Responses instructions in workflows
seonghobae Aug 25, 2026
f828a73
Merge remote-tracking branch 'origin/main' into feat/model-group-cost…
seonghobae Aug 25, 2026
21d47d1
test: align model-group missing-member code with canonical agent_not_…
seonghobae Aug 25, 2026
3d774fe
fix(api): model-group creation returns canonical agent_not_found for …
seonghobae Aug 25, 2026
1bc81de
ci: route hourly OpenCode loop through auto
seonghobae Aug 25, 2026
3a7f4a6
Merge branch 'feat/model-group-cost-aware-discovery' of https://githu…
seonghobae Aug 25, 2026
4f2daf0
fix: reject unsupported orchestrated structured output
seonghobae Aug 25, 2026
bccee78
docs: correct Responses stream options error
seonghobae Aug 25, 2026
63436f4
Merge remote-tracking branch 'origin/feat/model-group-cost-aware-disc…
seonghobae Aug 25, 2026
7181d3e
fix: retrieve URL-encoded model identifiers
seonghobae Aug 25, 2026
9a084d0
fix: measure free capability and failover routing
seonghobae Aug 25, 2026
3b0feb6
Merge pull request #843 from ContextualWisdomLab/feat/free-reasoning-…
seonghobae Aug 25, 2026
453c4de
Merge remote-tracking branch 'origin/main' into codex/pr834-review-fixes
seonghobae Aug 25, 2026
29915ef
fix: resolve model group review findings
seonghobae Aug 25, 2026
d4d1575
fix: close model group integration gaps
seonghobae Aug 25, 2026
40e00f8
fix: align provider inventory and session cache scope
seonghobae Aug 25, 2026
69cc674
fix: harden compose secrets and repeated reasoning summaries
seonghobae Aug 25, 2026
e2f4264
Merge remote-tracking branch 'origin/main' into codex/pr834-review-fixes
seonghobae Aug 25, 2026
5492f80
fix: contain binary response disconnects
seonghobae Aug 25, 2026
ce83f95
fix: ground Zen free discovery in structured costs
seonghobae Aug 25, 2026
bfc95d7
fix: keep group judge within allowed members
seonghobae Aug 25, 2026
4b1f2a8
fix: preserve free catalog evidence across reloads
seonghobae Aug 25, 2026
1b0d2dd
Merge remote-tracking branch 'origin/main' into codex/pr834-review-fixes
seonghobae Aug 25, 2026
f1fea50
docs: assign unique model-group ADR number
seonghobae Aug 25, 2026
098de8a
fix: preserve catalog capability evidence
seonghobae Aug 25, 2026
f9dc08b
fix: preserve declared Bytez endpoint capabilities
seonghobae Aug 25, 2026
8d27aa6
fix: validate batch model identity at ingress
seonghobae Aug 25, 2026
a11c541
fix(api): normalize missing model group errors
seonghobae Aug 25, 2026
9c02b19
docs(prd): align product bets with model groups
seonghobae Aug 25, 2026
a4269d9
fix(discovery): filter chat-only Bytez transports
seonghobae Aug 25, 2026
cb950a2
docs(adr): reserve model-group decision identifier
seonghobae Aug 25, 2026
8341ac6
Merge remote-tracking branch 'origin/main' into codex/pr834-review-fixes
seonghobae Aug 25, 2026
93b8016
feat: replace routing heuristics with measured evidence ledgers (#847)
seonghobae Aug 25, 2026
8b03206
fix(admin): tolerate unavailable model-group state
seonghobae Aug 25, 2026
c146d1e
docs(loop): require PRD and measured web capacity
seonghobae Aug 25, 2026
550c988
fix(admin): remove retired policy hint metric
seonghobae Aug 25, 2026
5ecdd3f
fix(routing): validate evidence before mutation
seonghobae Aug 25, 2026
7fa07ac
fix(discovery): remove model-name free inference guidance
seonghobae Aug 25, 2026
503365f
Merge remote-tracking branch 'origin/main' into pr834-work
seonghobae Aug 25, 2026
773caae
fix: complete #834 model-group persistence on the normalized agent-po…
seonghobae Aug 25, 2026
b03cd82
test: case-sensitive DDL pattern so prose cannot fake identifiers
seonghobae Aug 25, 2026
6201564
Merge remote-tracking branch 'origin/main' into codex/pr834-exact
seonghobae Aug 25, 2026
73f9a4f
docs: refresh protected-main gap evidence
seonghobae Aug 25, 2026
cef3498
docs: record exact provider regression suite
seonghobae Aug 26, 2026
daab699
docs: correct exact provider head
seonghobae Aug 26, 2026
a488687
fix(admin): make guidance customer-actionable
seonghobae Aug 26, 2026
a5f8d84
fix(admin): remove internal terms from customer copy
seonghobae Aug 26, 2026
6b6352e
docs(ui): record customer-copy screenshot audit
seonghobae Aug 26, 2026
ed0698d
test(ci): lock hourly orchestrator loop contract
seonghobae Aug 26, 2026
7896ac2
fix: replace synthetic admin status with truthful empty states
seonghobae Aug 26, 2026
d095eb4
docs: refresh exact-head remediation baseline
seonghobae Aug 26, 2026
e563920
fix(stream): cancel orchestration after Responses disconnect
seonghobae Aug 26, 2026
3bc37b4
test: align boundary contracts with current routing
seonghobae Aug 26, 2026
b189e10
docs: complete public boundary docstrings
seonghobae Aug 26, 2026
822a071
docs: refresh exact-head product gap queue
seonghobae Aug 26, 2026
7526fdb
test: enforce complete public docstrings
seonghobae Aug 26, 2026
ab3aab2
ci: enforce protected exact-head merge loop
seonghobae Aug 26, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
.git
.codegraph
.venv
.hypothesis
.secrets
__pycache__
*.pyc
*.db
build
dist
42 changes: 42 additions & 0 deletions .github/opencode/hourly-loop-prompt.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
You are the hourly maintenance agent for ContextualWisdomLab/contextual-orchestrator,
running through the contextual-orchestrator gateway itself. Provider models and
operator-managed groups are discovered from the gateway; never infer that two
differently named provider models are equivalent.

Work autonomously for at most 45 minutes, then stop with a short summary. Never
post intermediate progress reports. Priorities, in order:

1. PR merge loop. Read PR numbers only from `/tmp/trusted-pr-numbers.txt`, which
contains same-repository branches selected before the privileged agent starts.
Never query, read, check out, comment on, or merge any other PR in this run;
fork PRs require a separate secret-free review workflow. For every listed PR:
a. Read reviewer comments (OpenCode, Devin, CodeRabbit, Strix, Noema, humans) and fix
valid findings on the branch; push fixes.
b. Re-check GitHub Checks. Retry transient provider/rate-limit failures
once before investigating.
c. When every required check is green and no unresolved blocking review
remains, merge (squash).
d. Move to the next open PR. Do not force-push; other agents may have
pushed concurrently — pull/rebase instead and respect their commits.

2. Failing checks on main or scheduled workflows: trace logs to root cause and
open a focused fix PR (one concern per PR).

3. Product gaps. If no PRs remain open, pick the highest-leverage gap from
docs/product_planning.md only after reading it, then reconcile the choice
with docs/product-technical-gap-baseline.md. Implement it with tests +
docstrings and open a PR that updates the baseline file.

Rules:
- Keep each change minimal and reviewable; stack dependent PRs when natural.
- Follow AGENTS.md governance: KV credentials (never os.getenv at runtime),
snake_case two-word object names, 100% test/docstring coverage intent,
paper-grounded decisions with APA citations in docs.
- Never weaken security gates; never disable required workflows.
- Web changes must preserve asynchronous responsiveness. Run the checked-in k6
end-to-end scenario, record the measured concurrency envelope and bottleneck,
and improve only bottlenecks demonstrated by before/after evidence.
- Do not touch COPILOT_GITHUB_TOKEN or the existing review-agent key scheme.
- Do not invent routing weights, heuristics, or rules of thumb. Preserve measured
provider evidence and paper-grounded calibration; record missing evidence as a
gap instead of guessing.
158 changes: 158 additions & 0 deletions .github/workflows/opencode-hourly-loop.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
name: OpenCode hourly maintenance loop

# Hourly autonomous maintenance: an OpenCode agent whose model traffic is
# served by THIS repository's gateway (contextual-orchestrator) with
# auto-discovered providers and operator-managed model-group routing.
# The agent works the PR queue (review -> fix -> recheck -> merge), root-causes
# failing checks, and advances docs/product-technical-gap-baseline.md items.

on:
schedule:
- cron: "23 * * * *" # hourly at :23 UTC; offset avoids top-of-hour CI storms
workflow_dispatch:

permissions:
contents: read
pull-requests: write
issues: write

concurrency:
group: opencode-hourly-loop
cancel-in-progress: false

jobs:
external-pr-review:
name: Review external PR diffs without secrets
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: read
issues: none
steps:
- uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # actions/checkout@v7
with:
persist-credentials: false
fetch-depth: 0
- name: Validate untrusted fork diffs without executing them
env:
GH_TOKEN: ${{ github.token }}
run: |
set -euo pipefail
gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls?state=open&per_page=100" \
--jq '.[] | select(.head.repo.full_name != env.GITHUB_REPOSITORY) | [.number, .head.sha] | @tsv' |
while IFS=$'\t' read -r pr_number head_sha; do
[ -n "$pr_number" ] || continue
git fetch --no-tags origin "pull/${pr_number}/head:refs/review/external-${pr_number}"
test "$(git rev-parse "refs/review/external-${pr_number}")" = "$head_sha"
git diff --check "origin/main...refs/review/external-${pr_number}"
printf 'PR #%s head %s: diff integrity passed\n' "$pr_number" "$head_sha" >> "$GITHUB_STEP_SUMMARY"
Comment thread
seonghobae marked this conversation as resolved.
Resolved
done

loop:
name: Run OpenCode maintenance agent through the local gateway
runs-on: ubuntu-latest
timeout-minutes: 55
permissions:
contents: write # required for reviewed branch fixes; scoped to this job
pull-requests: write
issues: write
env:
# Bootstrap transport only: these flow into the process-local KV registry
# (see scripts/ci/serve_seeded_gateway.py); the gateway never reads them
# from the environment again after seeding. See docs/kv-credentials.md.
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
OPENROUTER_API_KEY: ${{ secrets.OPENROUTER_API_KEY }}
OPENCODE_ZEN_API_KEY: ${{ secrets.OPENCODE_ZEN_API_KEY }}
BYTEZ_API_KEY: ${{ secrets.BYTEZ_API_KEY }}
NVIDIA_NIM_API_KEY: ${{ secrets.NVIDIA_NIM_API_KEY }}
NVIDIA_NIM_API_KEY_SUB: ${{ secrets.NVIDIA_NIM_API_KEY_SUB }}
Comment thread
seonghobae marked this conversation as resolved.
Resolved
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # actions/checkout@v7
with:
persist-credentials: true # the agent needs to push fixes/branches

- name: Set up Python
uses: actions/setup-python@ece7cb06caefa5fff74198d8649806c4678c61a1 # actions/setup-python@v6
with:
python-version: "3.12"

- name: Set up Node for the OpenCode CLI
uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # actions/setup-node@v4
with:
node-version: "22"

- name: Install pinned runtime dependencies
run: python -m pip install --require-hashes -r fuzz/requirements-property.txt

- name: Install OpenCode CLI
run: npm ci --ignore-scripts
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved
Comment thread
devin-ai-integration[bot] marked this conversation as resolved.
Resolved

- name: Generate ephemeral loopback gateway token
run: |
gateway_token=$(python -c 'import secrets; print(secrets.token_urlsafe(32))')
echo "::add-mask::$gateway_token"
echo "GATEWAY_BEARER_TOKEN=$gateway_token" >> "$GITHUB_ENV"

Comment thread
github-advanced-security[bot] marked this conversation as resolved.
Fixed
Comment thread
seonghobae marked this conversation as resolved.
Fixed
- name: Start the contextual-orchestrator gateway with auto-discovery
run: |
set -euo pipefail
nohup python -m scripts.ci.serve_seeded_gateway \
--serve \
--agents examples/agents.mock.json \
--auto-discover-model-agents \
--auth-token "$GATEWAY_BEARER_TOKEN" \
--host 127.0.0.1 --port 8000 \
> /tmp/gateway.log 2>&1 &
for _attempt in $(seq 1 30); do
if curl -fsS -H "Authorization: Bearer ${GATEWAY_BEARER_TOKEN}" \
http://127.0.0.1:8000/healthz >/dev/null 2>&1; then
echo "gateway ready"
exit 0
fi
sleep 2
done
echo "::error::gateway did not become healthy"; tail -50 /tmp/gateway.log; exit 1

- name: Point OpenCode at the local gateway
run: |
set -euo pipefail
mkdir -p ~/.config/opencode
cat > ~/.config/opencode/opencode.json <<JSON
{
"\$schema": "https://opencode.ai/config.json",
"model": "contextual_orchestrator_gateway/orchestrator/auto",
"provider": {
"contextual_orchestrator_gateway": {
"npm": "@ai-sdk/openai-compatible",
"name": "Contextual Orchestrator Gateway",
"options": {
"baseURL": "http://127.0.0.1:8000/v1",
"apiKey": "${GATEWAY_BEARER_TOKEN}"
},
"models": {
"orchestrator/auto": { "name": "measured automatic orchestration" }
}
}
}
}
JSON

- name: Build trusted same-repository PR allowlist
env:
GH_TOKEN: ${{ github.token }}
run: |
gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls?state=open&per_page=100" \
--jq '.[] | select(.head.repo.full_name == env.GITHUB_REPOSITORY) | .number' \
> /tmp/trusted-pr-numbers.txt

- name: Run the hourly loop agent
env:
GH_TOKEN: ${{ github.token }}
run: |
./node_modules/.bin/opencode run --model contextual_orchestrator_gateway/orchestrator/auto \
"$(cat .github/opencode/hourly-loop-prompt.md)"
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved

- name: Dump gateway log on failure
if: failure()
run: tail -100 /tmp/gateway.log
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,5 @@ tempcred.txt

# hypothesis fuzzing DB
.hypothesis/
.secrets/
.coverage
51 changes: 44 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,45 @@
# Changelog

All notable changes to this project are documented in this file.
All notable changes to `contextual-orchestrator` are documented here. The
project follows Semantic Versioning; a version is released only after the
protected `main` branch, required Checks, independent review, and release
artifacts are verified on the same commit.

The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
## [0.2.0] - Unreleased

### Added

- Anti-heuristic routing evidence ladder (ADR 0034): `DOMAIN_HINTS` and
`COMPLEX_HINTS` keyword tables are deleted; ordering is now
eligibility contracts -> declaration priority/capability fit/cosine
affinity over operator-declared metadata (cached dense embeddings) ->
measured intra-group quality then successful responses per second, with
token throughput retained as diagnostic evidence. Workflow triage is
a strict structured call that fails closed to conducted orchestration;
verdicts are memoized by content hash. Real-time fast-mlsirm judging on
direct routes feeds a second Beta-Bernoulli quality ledger and drives
failover within the retry budget; `--no-realtime-judge` preserves the
legacy verification shape. APA 7 references live in
`docs/doctoring/measured-routing-evidence.md`.
- Product & technical gap baseline (`docs/product-technical-gap-baseline.md`)
indexing buyer-visible gaps against open PRs/issues with update protocol.
- Citation-backed `docs/adr` set: APA 7th references on the tool-execution fallback policy, plus accepted control-plane, cost-aware sync-versus-batch, and MSA-leaf composition ADRs, indexed from `docs/adr/README.md`.
- Structured tool failure categories, stable fallback actions, and public adapter exceptions.
- Structured tool failure categories, stable fallback actions, and public
adapter exceptions.
- Secret-free `tool_fallback_decision` audit events.
- Exact regression coverage for the Strix `Tool execute_command not found in agent strix` failure.
- Operator-managed model groups: `ModelAgent.group_name`, measured intra-group
routing (Beta(1,1) posterior success probability over Jacobson-gain EWMA
latency), group-alias model resolution, `/api/v1/model_groups` CRUD with
normalized persistence, Admin editing, and routing-evidence display across
text, image, video, speech, transcription, embeddings, rerank, and audio.
(#834, ADR 0032)
- OpenCode Zen provider discovery plus explicit free-tier classification from
structured Models.dev zero-price metadata; `discover-models --free-only`.
(#834)
- Versioned `reasoning_effort_profile` catalog (issue #568) with fail-closed
parse, per-role bindings, replayable snapshot hash, and an equal-budget
true-θ RMSE ablation that emits θ̂ and RMSE(θ̂, θ). Sampling temperature
Expand Down Expand Up @@ -40,13 +67,16 @@ and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
- Missing or unavailable tools move to the next eligible agent instead of terminating the workflow immediately.
- Return the same `agent_not_found` error code for GET, PATCH, and DELETE worker
agent requests that address an unknown or unauthorized pool member.
- Strix B105 false positives eliminated at the source: KV credential-name
constants renamed `*_CREDENTIAL_NAME`; readiness label keys renamed
`readiness_ok/warning/failure`. (#833)

### Security

- Ambiguous non-idempotent outcomes, invalid arguments, permission denial, and policy denial fail closed.
- Fallback errors and audit events do not copy provider exception text, tool arguments, outputs, or credentials; fail-closed exceptions also sever the original cause chain so later traceback logging cannot recover them.
- Worker-agent pool boundaries are enforced beside object lookup so a
different-pool id can no longer read or mutate another pool's agent.
- Ambiguous non-idempotent outcomes, invalid arguments, permission denial, and policy denial fail closed.
- Fallback errors and audit events do not copy provider exception text, tool arguments, outputs, or credentials; fail-closed exceptions also sever the original cause chain so later traceback logging cannot recover them.
- Worker-agent pool boundaries are enforced beside object lookup so a
different-pool id can no longer read or mutate another pool's agent.

### References

Expand All @@ -61,3 +91,10 @@ and this project uses [Semantic Versioning](https://semver.org/spec/v2.0.0.html)
- Baker, F. B. (2001). *The basics of item response theory* (2nd ed.).
ERIC Clearinghouse on Assessment and Evaluation.
https://eric.ed.gov/?id=ED458219

## [0.1.0] - Unreleased

This is the current development baseline, not a published release. It
provides the OpenAI-compatible gateway, route/conduct orchestration, workflow
and access evidence, provider credential boundaries, cost and readiness
reporting, and security-focused contract tests.
Comment thread
seonghobae marked this conversation as resolved.
Resolved
11 changes: 7 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Contextual Orchestrator — stdlib-only Python, so the image is just the source
# tree on a slim Python base. Runs the OpenAI-compatible server.
# Contextual Orchestrator OpenAI-compatible server with the Postgres KV driver.
#
# Build: docker build -t contextual-orchestrator .
# Run : seed CONTEXTUAL_ORCHESTRATOR_TOKEN and provider credentials into the KV
Expand All @@ -13,13 +12,17 @@
FROM python:3.12-slim@sha256:423ed6ab25b1921a477529254bfeeabf5855151dc2c3141699a1bfc852199fbf

WORKDIR /app
COPY contextual_orchestrator/ contextual_orchestrator/
COPY pyproject.toml requirements.lock README.md LICENSE ./
RUN pip install --no-cache-dir --require-hashes -r requirements.lock
COPY contextual_orchestrator/ /usr/local/lib/python3.12/site-packages/contextual_orchestrator/
COPY examples/ examples/

ENV AGENTS_FILE=/app/examples/agents.mock.json \
PORT=8000

RUN useradd --uid 10001 --no-create-home orchestrator
RUN useradd --uid 10001 --create-home orchestrator \
&& mkdir -p /var/lib/contextual-orchestrator \
&& chown -R orchestrator:orchestrator /var/lib/contextual-orchestrator
USER orchestrator

EXPOSE 8000
Expand Down
31 changes: 31 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,37 @@ model-like orchestration candidate while keeping the worker pool, routing,
workflow, and verification logic behind it. `contextual-orchestrator` is the
public control-plane model; it is not just an HTTP gateway.

## Docker Compose

The canonical path is `compose.yaml`. It starts PostgreSQL, seeds the server
token into the encrypted KV from a Compose secret, and binds the gateway to
loopback:

```bash
umask 077
mkdir -p .secrets
chmod 700 .secrets
printf '%s' 'replace-with-a-long-random-token' > .secrets/server-token
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
chmod 600 .secrets/server-token
export TOKEN="$(cat .secrets/server-token)"
export CONTEXTUAL_ORCHESTRATOR_POSTGRES_PASSWORD='replace-with-a-database-password'
export CONTEXTUAL_ORCHESTRATOR_KV_PASSPHRASE='replace-with-an-encryption-passphrase'
docker compose up --build --wait
curl http://127.0.0.1:8000/healthz
```

Register provider keys separately with `register-credential`; do not put them
in `compose.yaml` or the gateway runtime environment.

For orchestration with OpenAI Responses-native reasoning summaries, select
`orchestrator/auto` or the fail-closed zero-cost pool `orchestrator/free`:

```bash
curl -N http://127.0.0.1:8000/v1/responses \
-H "Authorization: Bearer $TOKEN" -H 'Content-Type: application/json' \
-d '{"model":"orchestrator/free","input":"Research and verify this","reasoning":{"summary":"auto"},"stream":true}'
Comment thread
coderabbitai[bot] marked this conversation as resolved.
Resolved
```

## Quick Start

```bash
Expand Down
Loading
Loading