Repository navigation
feat: publish paper-grounded automatic orchestration contract #766
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
2a4270a
125bfc1
32ba3a9
c138d17
ddd0591
bbb6361
ab0c05c
fccac33
54dfce2
21a17f0
13fe555
a107892
8394373
da24b1a
583c4f3
c1c7997
216177f
56d3085
8fee52b
5b49594
1ffdc3f
ea254c2
2e76caa
ea4dfa9
46725e2
c7b5dbc
79ce905
4af8e26
f7b2079
17d636b
b7ee4bb
becc758
a1d8128
fe7b632
8a88063
5ea0f77
d3ed441
a159dff
4d8cd86
998c86f
fb16482
76de3e1
51ac452
ec94d99
7cb34a9
c646ba5
5d80e11
454b9f5
b81f8d7
173288c
f7141ea
361725b
d3abf51
8aaa0e0
823ce91
c5e0286
4b954e4
73c6c98
e59ef71
a29ff9e
1eef1e9
9bc620d
0f61128
78894f6
d82e592
9b6dec3
d8c1b73
a0a354a
618810e
db45804
f8cac36
6422a20
18d8c3b
e0000ad
c518049
c2bb2b2
2f904a2
bd4c1a3
fe8437d
bcb55d0
c860644
273943e
b782b01
a7de9f6
96501bb
910d9ef
9d4562f
435c3ef
153ca6b
fa20fe3
2f42a1b
d83a029
d1f97a2
c460270
36b3d2a
cc0d295
54ef9bb
237ba2d
01aafd5
f783e95
bb88bf7
7f47665
c722fa8
f3d54b1
af500ee
cb88960
1614c7f
adc4f80
67ed128
e5180c3
490dfd8
0df4267
cc413a4
f6456e1
8ecd379
3f33a72
2816140
d3480cc
6373d98
63451a0
6354c04
62100d3
bd2515f
b36878c
52e0746
29e1388
b30697d
160471b
a5f7697
7cfad1b
d00431e
4465922
da849d3
27aa4ad
b2b3d8e
d1bc819
8bf757f
8194e04
383ccfd
50b91c3
792c9ce
b72a838
e99b097
abfb45a
9f45226
eaf7ff3
bad1e1a
a07c11f
19c3e88
4923447
a9278d1
c0c2ecb
73853a4
3ab44dd
474b667
1d3e062
1b22ff0
bc882c0
0fb8fdb
f0f30f3
3bc1264
8f922d8
1c5b5c8
9f662c4
070d929
53f47a6
dac931f
229bb30
f15ccb0
c6f30eb
228126b
cdca9d8
018f6ef
c580839
61f94a0
c179b54
ccfa292
15a16d8
06dfa40
b1dc49e
87e1c3b
df5f5bf
a9cd011
71164ae
a139ece
1c05e20
bd78ca1
ebc76d4
719d9cc
e9935d7
aeae379
efc4b5f
1003cea
40b7bac
2e36f9b
491566e
887cc66
cdfc15d
fcb82a1
3a59b67
007acf6
0b19112
60d9cfc
9058a08
e3e9788
621c42f
d7133c4
64b6d56
e0413fe
68002d0
d5236bb
de4d95a
2acb3a4
775ea13
badcf28
6a411be
d2072fa
63d9abf
83b17bd
a1d486a
785d125
b01c1f0
d97e481
4cf6114
f16c751
bfecabd
5913c2a
b3a81ac
c064db5
146ae37
76941bd
b200ca9
1d4910d
624e8c3
0d6b5bd
6e5a9b1
fdf83bd
ff24865
e3b818a
eba2671
6e7d44a
7af21d7
b5436e0
9cc2918
7bcb977
af228e5
81364ee
0298693
4a90126
11ac446
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| project_slug: contextual-orchestrator | ||
| owner: ContextualWisdomLab | ||
| default_status: proposed | ||
| decision_id_format: NNNN | ||
| template_source: madr-v4 | ||
| last_decision_id: 0009 | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,7 +8,7 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co | |
|
|
||
| - **Security gate**: every PR to `main` runs the required Security workflow. A failing Trivy or pip-audit job is a real finding — remediate by bumping the dependency and regenerating `requirements.lock`; never weaken, `continue-on-error`, or disable the gate. | ||
| - **KV, not env**: runtime config and provider secrets are resolved from the KV credential registry (`get_credential`), never `os.getenv` at request time. Env is only bootstrap transport into the KV (see `docs/kv-credentials.md`). | ||
| - **Org role**: this repo is the org's LLM gateway (cost optimizer + sync/batch routing + upstream load balancing, LiteLLM-plus scope), consumed by `gyeot` and `scopeweave`. The OpenCode review pipeline is separate, stays on GitHub Models, and must not be changed. | ||
| - **Org role**: this repo is the org's LLM gateway (cost optimizer + sync/batch routing + upstream load balancing, LiteLLM-plus scope), consumed by `gyeot` and `scopeweave`. As of 2026-08-18, OpenCode/Noema/Strix (the org's CI review pipeline in `ContextualWisdomLab/.github`) are being migrated onto this gateway as their shared backend — see AGENTS.md's "This repo: the org LLM gateway" section for the full policy and scope. | ||
| - **Research grounding**: substantive feature/process PRs should attach the relevant papers (PDF when redistribution is permissible, otherwise cite + link + summary) under `docs/papers/` with full citations. | ||
|
|
||
| This file complements AGENTS.md with commands and architecture; where they differ, AGENTS.md wins. | ||
|
|
@@ -44,8 +44,9 @@ python fuzz/fuzz_request_body.py -max_total_time=60 fuzz/corpus/request_body | |
| python -m contextual_orchestrator "your prompt" --agents examples/agents.mock.json | ||
|
|
||
| # Serve the OpenAI-compatible API + /admin console | ||
| export CONTEXTUAL_ORCHESTRATOR_TOKEN="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')" | ||
| python -m contextual_orchestrator --serve --agents examples/agents.mock.json --port 8000 | ||
| local_token="$(python -c 'import secrets; print(secrets.token_urlsafe(32))')" | ||
| python -m contextual_orchestrator --serve --agents examples/agents.mock.json --port 8000 \ | ||
| --auth-token "$local_token" | ||
|
Comment on lines
+47
to
+49
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🔒 Security & Privacy | 🟠 Major | ⚡ Quick win 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -euo pipefail
rg -n -C 5 -- '--auth-token|auth_token' contextual_orchestratorRepository: ContextualWisdomLab/contextual-orchestrator Length of output: 12703 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- CLAUDE.md ---'
cat -n CLAUDE.md | sed -n '35,58p'
printf '%s\n' '--- candidate files ---'
fd -t f '(^|)(__main__|credentials|credential|README|CLAUDE)\.' . | head -80
printf '%s\n' '--- credential resolution and documentation references ---'
rg -n -C 4 'get_credential|DEFAULT_AUTH_TOKEN_KEY|auth-token-key|credential|KV|key.?value|token' \
--glob '*.py' --glob '*.md' --glob '*.json' .Repository: ContextualWisdomLab/contextual-orchestrator Length of output: 50402 🏁 Script executed: #!/bin/bash
set -euo pipefail
printf '%s\n' '--- CLAUDE.md lines 35-58 ---'
cat -n CLAUDE.md | sed -n '35,58p'
printf '%s\n' '--- credential implementation ---'
cat -n contextual_orchestrator/credentials.py | sed -n '1,220p'
printf '%s\n' '--- CLI token resolution ---'
cat -n contextual_orchestrator/__main__.py | sed -n '55,85p;255,290p;365,412p'
printf '%s\n' '--- focused documentation matches ---'
rg -n -C 3 -- '--auth-token-key|DEFAULT_AUTH_TOKEN_KEY|credential name|credential store|KV' \
README.md CLAUDE.md docs contextual_orchestrator tests \
-g '*.md' -g '*.py' | head -300Repository: ContextualWisdomLab/contextual-orchestrator Length of output: 43972 인증 토큰을
🤖 Prompt for AI Agents |
||
|
|
||
| # Loopback-only local dev server (auth disabled; loopback only) | ||
| ./.superset/run.sh | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,10 +2,11 @@ | |
| # tree on a slim Python base. Runs the OpenAI-compatible server. | ||
| # | ||
| # Build: docker build -t contextual-orchestrator . | ||
| # Run : docker run --rm -p 8000:8000 \ | ||
| # -e CONTEXTUAL_ORCHESTRATOR_TOKEN=change-me \ | ||
| # -e OPENAI_API_KEY=sk-... \ | ||
| # contextual-orchestrator | ||
| # Run : seed CONTEXTUAL_ORCHESTRATOR_TOKEN and provider credentials into the KV | ||
| # registry first, then use: | ||
| # docker run --rm -p 8000:8000 contextual-orchestrator | ||
| # Runtime secrets are never passed through the container environment or argv; | ||
| # see docs/kv-credentials.md for the bootstrap flow. | ||
|
Comment on lines
+5
to
+9
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🩺 Stability & Availability | 🟠 Major | 🏗️ Heavy lift 🧩 Analysis chain🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- tracked candidate files ---'
git ls-files | rg '(^|/)(Dockerfile|README\.md|.*credential.*|.*kv.*|.*auth.*)' | head -200
printf '%s\n' '--- Dockerfile ---'
cat -n Dockerfile
printf '%s\n' '--- README credential/backend references ---'
rg -n -C 5 'in-memory|process-local|test-only|credential backend|KV|register-credential|auth-token|CONTEXTUAL_ORCHESTRATOR_TOKEN' README.md docs .github 2>/dev/null | head -300
printf '%s\n' '--- credential and KV implementations/usages ---'
rg -n -C 4 'register-credential|auth-token-key|CONTEXTUAL_ORCHESTRATOR_TOKEN|process-local|in.memory|InMemory|Redis|KV|credential' --glob '!node_modules/**' --glob '!dist/**' --glob '!build/**' . | head -500Repository: ContextualWisdomLab/contextual-orchestrator Length of output: 50401 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- credential backend implementation ---'
cat -n contextual_orchestrator/credentials.py
printf '%s\n' '--- KV credential documentation ---'
sed -n '66,132p' docs/kv-credentials.md
printf '%s\n' '--- CLI bootstrap and serve setup ---'
sed -n '1,190p' contextual_orchestrator/__main__.py
sed -n '244,390p' contextual_orchestrator/__main__.py
printf '%s\n' '--- backend and auth tests ---'
rg -n -C 8 'CONTEXTUAL_ORCHESTRATOR_KV_BACKEND|CONTEXTUAL_ORCHESTRATOR_KV_DSN|CONTEXTUAL_ORCHESTRATOR_KV_PASSPHRASE|auth-token-key|server auth credential|InMemoryCredentialBackend|PostgresCredentialBackend' tests contextual_orchestrator/credentials.py contextual_orchestrator/__main__.py
printf '%s\n' '--- Docker build inputs relevant to bootstrap ---'
rg -n 'COPY|ENTRYPOINT|CMD|CONTEXTUAL_ORCHESTRATOR_KV|register-credential|postgres' Dockerfile .dockerignore compose*.yml docker-compose*.yml 2>/dev/null || true
printf '%s\n' '--- static verifier: extract defaults and required auth path without importing repository code ---'
python3 - <<'PY'
import ast
from pathlib import Path
def parse(path):
return ast.parse(Path(path).read_text())
cred = parse("contextual_orchestrator/credentials.py")
main = parse("contextual_orchestrator/__main__.py")
def find_class(tree, name):
return next(n for n in tree.body if isinstance(n, ast.ClassDef) and n.name == name)
def find_func(tree, name):
return next(n for n in ast.walk(tree) if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef)) and n.name == name)
backend = find_class(cred, "InMemoryCredentialBackend")
backend_init = find_func(ast.Module(body=backend.body, type_ignores=[]), "__init__")
print("InMemoryCredentialBackend.__init__ =", ast.unparse(backend_init.body))
for name in ("_resolve_auth_token", "_register_credential_command"):
fn = find_func(main, name)
print(f"{name} =", ast.unparse(fn))
docker = Path("Dockerfile").read_text()
print("Dockerfile selects KV backend explicitly =", "CONTEXTUAL_ORCHESTRATOR_KV_BACKEND" in docker)
print("Dockerfile passes KV DSN explicitly =", "CONTEXTUAL_ORCHESTRATOR_KV_DSN" in docker)
print("Dockerfile passes KV passphrase explicitly =", "CONTEXTUAL_ORCHESTRATOR_KV_PASSPHRASE" in docker)
print("Dockerfile starts with auth-token-key =", "--auth-token-key CONTEXTUAL_ORCHESTRATOR_TOKEN" in docker)
PYRepository: ContextualWisdomLab/contextual-orchestrator Length of output: 50401 🏁 Script executed: #!/bin/bash
set -eu
printf '%s\n' '--- remaining serve resolution path ---'
sed -n '360,450p' contextual_orchestrator/__main__.py
printf '%s\n' '--- packaging and Docker dependency facts ---'
fd -HI -t f 'pyproject.toml|setup.py|setup.cfg|requirements*.txt|Dockerfile*' .
for f in $(fd -HI -t f 'pyproject.toml|setup.py|setup.cfg|requirements*.txt' .); do
printf '\n--- %s ---\n' "$f"
rg -n -C 3 'psycopg|db|dependencies|optional|project|requires' "$f" | head -160
done
printf '%s\n' '--- focused tests and docs for Docker/auth behavior ---'
rg -n -C 5 'Docker|docker run|postgres|KV_BACKEND|KV_DSN|KV_PASSPHRASE|_resolve_auth_token|auth-token-key' README.md docs tests contextual_orchestrator/__main__.py | head -300
printf '%s\n' '--- static verifier: model the two-process backend boundary from source literals ---'
python3 - <<'PY'
import ast
from pathlib import Path
tree = ast.parse(Path("contextual_orchestrator/credentials.py").read_text())
main = ast.parse(Path("contextual_orchestrator/__main__.py").read_text())
docker = Path("Dockerfile").read_text()
def fn(tree, name):
return next(n for n in ast.walk(tree)
if isinstance(n, (ast.FunctionDef, ast.AsyncFunctionDef)) and n.name == name)
select = fn(tree, "_select_backend")
get_backend = fn(tree, "get_backend")
resolve = fn(main, "_resolve_auth_token")
print("backend default:", ast.unparse(select.body[0]))
print("memory branch:", ast.unparse(select.body[1]))
print("postgres branch:", ast.unparse(select.body[2]))
print("backend lifetime:", ast.unparse(get_backend.body))
print("auth resolution:", ast.unparse(resolve.body))
print("Docker passes backend selector:", "CONTEXTUAL_ORCHESTRATOR_KV_BACKEND" in docker)
print("Docker passes DSN:", "CONTEXTUAL_ORCHESTRATOR_KV_DSN" in docker)
print("Docker passes passphrase:", "CONTEXTUAL_ORCHESTRATOR_KV_PASSPHRASE" in docker)
print("Docker includes psycopg install:", "psycopg" in docker)
print("Docker starts server with KV key:", "--auth-token-key CONTEXTUAL_ORCHESTRATOR_TOKEN" in docker)
PYRepository: ContextualWisdomLab/contextual-orchestrator Length of output: 28219 Docker 절차가 영속 KV를 사용하도록 수정하세요. 기본 🤖 Prompt for AI AgentsSource: Coding guidelines |
||
| # Agents: defaults to the bundled mock pool; mount your own and set AGENTS_FILE: | ||
| # -v ./agents.json:/app/agents.json -e AGENTS_FILE=/app/agents.json | ||
| # python:3.12-slim | ||
|
|
@@ -26,4 +27,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s \ | |
| CMD ["python", "-c", "import urllib.request,os;urllib.request.urlopen(f'http://127.0.0.1:{os.environ.get(\"PORT\",\"8000\")}/healthz', timeout=2)"] | ||
|
|
||
| # --allow-public-bind: 컨테이너 내부 0.0.0.0 바인딩 필요(외부 노출은 호스트 포트 매핑이 결정) | ||
| CMD ["sh", "-c", "python -m contextual_orchestrator --serve --agents \"$AGENTS_FILE\" --host 0.0.0.0 --port \"$PORT\" --allow-public-bind"] | ||
| CMD ["sh", "-c", "python -m contextual_orchestrator --serve --agents \"$AGENTS_FILE\" --host 0.0.0.0 --port \"$PORT\" --allow-public-bind --auth-token-key CONTEXTUAL_ORCHESTRATOR_TOKEN"] | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: ContextualWisdomLab/contextual-orchestrator
Length of output: 210
🏁 Script executed:
Repository: ContextualWisdomLab/contextual-orchestrator
Length of output: 1521
🏁 Script executed:
Repository: ContextualWisdomLab/contextual-orchestrator
Length of output: 7052
ADR 생성 순번을
0011로 갱신하세요.0010과0011ADR이 저장소에 존재하며 모두 커밋되어 있습니다.last_decision_id를0011로 설정하세요.🤖 Prompt for AI Agents