melchizedek-agents 1.1.0 → 1.3.0
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.
- package/.env.example +19 -0
- package/AGENT_SETUP.md +3 -1
- package/CHANGELOG.md +373 -0
- package/DOCUMENTATION.md +193 -21
- package/ONBOARDING.md +378 -0
- package/QUICKSTART.md +15 -2
- package/README.md +26 -3
- package/config/agents/examples/connectors.yaml +82 -0
- package/config/agents/examples/council.yaml +1 -1
- package/config/agents/examples/critic.yaml +8 -8
- package/config/agents/examples/image_production.yaml +4 -3
- package/config/agents/syndicate.schema.json +389 -33
- package/config/agents/syndicateSchema.yaml +18 -6
- package/config/agents/templates/intake_extractor.yaml +3 -2
- package/config/agents/templates/systems_operator.yaml +5 -2
- package/dist/lib/a2a/app.d.ts +12 -0
- package/dist/lib/a2a/app.js +25 -11
- package/dist/lib/a2a/executor.js +14 -6
- package/dist/lib/a2a/oauthSetup.d.ts +16 -0
- package/dist/lib/a2a/oauthSetup.js +77 -8
- package/dist/lib/agentDialect.d.ts +18 -8
- package/dist/lib/agentDialect.js +36 -19
- package/dist/lib/chatgpt/adapter.d.ts +50 -0
- package/dist/lib/chatgpt/adapter.js +107 -0
- package/dist/lib/chatgpt/cli.d.ts +23 -0
- package/dist/lib/chatgpt/cli.js +77 -0
- package/dist/lib/chatgpt/oauth.d.ts +103 -0
- package/dist/lib/chatgpt/oauth.js +448 -0
- package/dist/lib/chatgpt/state.d.ts +98 -0
- package/dist/lib/chatgpt/state.js +145 -0
- package/dist/lib/chatgpt/store.d.ts +24 -0
- package/dist/lib/chatgpt/store.js +94 -0
- package/dist/lib/compile.d.ts +38 -7
- package/dist/lib/compile.js +97 -62
- package/dist/lib/compileNative.d.ts +11 -3
- package/dist/lib/compileNative.js +18 -1
- package/dist/lib/dispatch.js +6 -2
- package/dist/lib/doctor.d.ts +107 -0
- package/dist/lib/doctor.js +217 -7
- package/dist/lib/loadSyndicate.d.ts +15 -0
- package/dist/lib/mcp/server.d.ts +195 -0
- package/dist/lib/mcp/server.js +564 -0
- package/dist/lib/memory/supabaseMemoryService.js +2 -2
- package/dist/lib/models/adapterResolver.js +6 -1
- package/dist/lib/models/capabilities.d.ts +9 -0
- package/dist/lib/models/capabilities.js +24 -0
- package/dist/lib/models/chatCompletionsAdapter.d.ts +11 -3
- package/dist/lib/models/chatCompletionsAdapter.js +19 -5
- package/dist/lib/models/claudeAdapter.js +4 -0
- package/dist/lib/models/contract.d.ts +5 -2
- package/dist/lib/models/gateway.d.ts +3 -2
- package/dist/lib/models/gateway.js +8 -4
- package/dist/lib/models/gatewayAdapter.d.ts +7 -1
- package/dist/lib/models/gatewayAdapter.js +8 -0
- package/dist/lib/models/geminiAdapter.js +8 -2
- package/dist/lib/models/genaiMapping.d.ts +8 -4
- package/dist/lib/models/genaiMapping.js +23 -9
- package/dist/lib/models/gptAdapter.d.ts +4 -2
- package/dist/lib/models/gptAdapter.js +11 -4
- package/dist/lib/models/grokAdapter.d.ts +3 -1
- package/dist/lib/models/grokAdapter.js +11 -3
- package/dist/lib/models/kimiAdapter.d.ts +2 -1
- package/dist/lib/models/kimiAdapter.js +3 -3
- package/dist/lib/models/reasoning.d.ts +30 -2
- package/dist/lib/models/reasoning.js +56 -5
- package/dist/lib/onboarding.d.ts +135 -0
- package/dist/lib/onboarding.js +578 -0
- package/dist/lib/runtime/approvals.d.ts +2 -0
- package/dist/lib/runtime/approvals.js +4 -3
- package/dist/lib/runtime/credentials.d.ts +6 -0
- package/dist/lib/runtime/native/agentLoop.d.ts +5 -2
- package/dist/lib/runtime/native/agentLoop.js +2 -0
- package/dist/lib/runtime/native/checkpoint.d.ts +12 -5
- package/dist/lib/runtime/native/checkpoint.js +13 -19
- package/dist/lib/runtime/native/delegate.d.ts +82 -1
- package/dist/lib/runtime/native/delegate.js +157 -2
- package/dist/lib/runtime/native/interrupts.d.ts +88 -5
- package/dist/lib/runtime/native/interrupts.js +220 -30
- package/dist/lib/runtime/syndicateTurn.d.ts +4 -2
- package/dist/lib/runtime/syndicateTurn.js +324 -77
- package/dist/lib/runtime/turnControl.d.ts +41 -0
- package/dist/lib/session/transcript.d.ts +9 -0
- package/dist/lib/session/transcript.js +20 -1
- package/dist/lib/skills.d.ts +18 -0
- package/dist/lib/skills.js +73 -1
- package/dist/lib/storage/postgres/index.d.ts +6 -1
- package/dist/lib/storage/postgres/index.js +1 -1
- package/dist/lib/storage/postgres/taskQueue.d.ts +7 -3
- package/dist/lib/storage/postgres/taskQueue.js +10 -3
- package/dist/lib/syndicateSchema.d.ts +184 -9
- package/dist/lib/syndicateSchema.js +143 -29
- package/dist/lib/tools/auth.d.ts +13 -1
- package/dist/lib/tools/auth.js +10 -2
- package/dist/lib/tools/credentialHosts.d.ts +88 -0
- package/dist/lib/tools/credentialHosts.js +165 -0
- package/dist/lib/tools/credentialUses.d.ts +98 -0
- package/dist/lib/tools/credentialUses.js +120 -0
- package/dist/lib/tools/generateImageTool.js +2 -1
- package/dist/lib/tools/inspectImageTool.js +1 -1
- package/dist/lib/tools/mcpToolFactory.d.ts +29 -1
- package/dist/lib/tools/mcpToolFactory.js +72 -26
- package/dist/lib/tools/mcpTransports.d.ts +12 -0
- package/dist/lib/tools/mcpTransports.js +11 -0
- package/dist/lib/tools/oauthConsent.d.ts +18 -3
- package/dist/lib/tools/oauthConsent.js +57 -15
- package/dist/lib/tools/oauthDiscovery.d.ts +202 -0
- package/dist/lib/tools/oauthDiscovery.js +616 -0
- package/dist/lib/tools/oauthHosts.d.ts +2 -0
- package/dist/lib/tools/oauthHosts.js +2 -2
- package/dist/lib/tools/oauthTools.d.ts +54 -13
- package/dist/lib/tools/oauthTools.js +106 -23
- package/dist/lib/tools/openapiTools.d.ts +7 -0
- package/dist/lib/tools/openapiTools.js +49 -3
- package/dist/lib/tools/taskTools.d.ts +32 -2
- package/dist/lib/tools/taskTools.js +93 -33
- package/dist/lib/tools/xApiSearchTool.js +2 -2
- package/dist/lib/workflow/turn.d.ts +22 -3
- package/dist/lib/workflow/turn.js +151 -31
- package/dist/lib/workflow.d.ts +10 -7
- package/dist/lib/workflow.js +10 -7
- package/dist/scripts/a2a_server.d.ts +2 -2
- package/dist/scripts/a2a_server.js +19 -2
- package/dist/scripts/assistant_worker.d.ts +2 -0
- package/dist/scripts/assistant_worker.js +24 -5
- package/dist/scripts/doctor.d.ts +4 -2
- package/dist/scripts/doctor.js +6 -4
- package/dist/scripts/mcp_server.d.ts +12 -0
- package/dist/scripts/mcp_server.js +345 -0
- package/dist/scripts/setup.d.ts +25 -0
- package/dist/scripts/setup.js +181 -0
- package/dist/scripts/skills_install.d.ts +3 -1
- package/dist/scripts/skills_install.js +17 -2
- package/dist/scripts/syndicate_chat.js +12 -3
- package/dist/scripts/yaml_codemod.d.ts +12 -2
- package/dist/scripts/yaml_codemod.js +115 -33
- package/package.json +8 -2
- package/skills/README.md +11 -2
- package/skills/briefs/_shared.md +1 -1
- package/skills/briefs/melchizedek-models.md +4 -2
- package/skills/briefs/skills-readme.md +3 -1
- package/skills/melchizedek-models/SKILL.md +6 -2
- package/skills/melchizedek-onboard/SKILL.md +71 -0
- package/skills/melchizedek-onboard-cloud/SKILL.md +38 -0
- package/skills/melchizedek-onboard-keys/SKILL.md +47 -0
- package/skills/melchizedek-onboard-local/SKILL.md +41 -0
- package/skills/melchizedek-onboard-serve/SKILL.md +43 -0
package/skills/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
## What this is
|
|
4
4
|
|
|
5
|
-
This directory contains a suite of
|
|
5
|
+
This directory contains a suite of eleven Agent Skills built to the open SKILL.md standard: one directory per skill, a SKILL.md file with `name` and `description` frontmatter, and optional supporting files. The skills teach a coding agent how to onboard a person from the credentials they have, and how to find, run, author, serve, remember with, and write with Melchizedek syndicates. They ship in the npm package melchizedek-agents and in the public repository, inside `skills/`.
|
|
6
6
|
|
|
7
7
|
## The skills
|
|
8
8
|
|
|
@@ -13,6 +13,14 @@ This directory contains a suite of six Agent Skills built to the open SKILL.md s
|
|
|
13
13
|
- `melchizedek-models`: Teaches model ids and providers, keys, keyless Ollama, the gateway fallback, per-agent settings, and the errors.
|
|
14
14
|
- `melchizedek-scribe`: Teaches writing documents from a brief with the Scribe syndicate.
|
|
15
15
|
|
|
16
|
+
Five onboarding skills route a person by what they have and walk the startup guide for it (`npx melchizedek-setup --level <id>` prints each guide):
|
|
17
|
+
|
|
18
|
+
- `melchizedek-onboard`: The triage. Asks what the person has and routes to one of ten authentication levels and the skill below that owns it.
|
|
19
|
+
- `melchizedek-onboard-local`: No key: Ollama and the keyless syndicates.
|
|
20
|
+
- `melchizedek-onboard-keys`: One provider's key, several, a gateway key, Sign in with ChatGPT on the person's own machine, and the honest answer for a Codex, Claude.ai or Gemini CLI sign-in.
|
|
21
|
+
- `melchizedek-onboard-cloud`: Vertex AI, Amazon Bedrock and Azure OpenAI credentials.
|
|
22
|
+
- `melchizedek-onboard-serve`: Serving to others: per-caller keys (BYOK), caller identities (`A2A_AUTH`), and OAuth tool grants.
|
|
23
|
+
|
|
16
24
|
## Install
|
|
17
25
|
|
|
18
26
|
Install the skills using any of three methods.
|
|
@@ -37,6 +45,7 @@ The command accepts these flags:
|
|
|
37
45
|
- `--only <names>` installs a subset.
|
|
38
46
|
- `--force` overwrites a file that differs.
|
|
39
47
|
- `--dry-run` prints without writing.
|
|
48
|
+
- `--agents-md` also writes a pointer block into the project's `AGENTS.md` (created when absent; only the block between its markers is ever rewritten).
|
|
40
49
|
|
|
41
50
|
You can inspect target paths and available skills:
|
|
42
51
|
|
|
@@ -69,6 +78,6 @@ Install by hand by copying any `skills/<name>/` directory into a target location
|
|
|
69
78
|
|
|
70
79
|
## How the prose was written
|
|
71
80
|
|
|
72
|
-
The Scribe syndicate (`config/agents/examples/scribe.yaml`, a Gemini agent that writes a document from a technical brief and audits it against the brief) wrote
|
|
81
|
+
The five onboarding skills are short procedures written by hand: they print their facts from `melchizedek-setup` instead of restating them, so the facts live in one place (`lib/onboarding.ts`). The Scribe syndicate (`config/agents/examples/scribe.yaml`, a Gemini agent that writes a document from a technical brief and audits it against the brief) wrote every other SKILL.md body from one brief per skill. A person then reviewed each file. The briefs carry the facts; the Scribe carries the voice. To change a skill, change the facts and rerun with the melchizedek-scribe skill.
|
|
73
82
|
|
|
74
83
|
The suite shares the MIT license of the package.
|
package/skills/briefs/_shared.md
CHANGED
|
@@ -5,7 +5,7 @@ SHARED FACTS (true for every document in this series; use those the section need
|
|
|
5
5
|
- The loader reads syndicate files from `<cwd>/config/agents/` by default. A bare name (`tutor`) resolves to `config/agents/tutor.yaml` at the root first, then `config/agents/examples/tutor.yaml`. The environment variable MELCHIZEDEK_AGENTS_DIR, or `loadSyndicate(file, { agentsDir })` in code, points the loader at another directory; the loader refuses any path outside that directory.
|
|
6
6
|
- The starter pack: nineteen example syndicates ship in the package at `node_modules/melchizedek-agents/config/agents/examples/` (in a clone: `config/agents/examples/`), beside `syndicateSchema.yaml`, the annotated reference for every field. Every example opens with a `# tier:` comment line: `keyless` (every agent is an ollama/* model), a single provider such as `gemini` or `anthropic`, or `multi-provider`.
|
|
7
7
|
- Keys live in a `.env` file at the working directory; real environment variables win over the file. The Gemini key is GOOGLE_GENAI_API_KEY. No key value is ever printed by any framework command.
|
|
8
|
-
- This document is one of
|
|
8
|
+
- This document is one of the Scribe-written skills in the melchizedek suite (the six: melchizedek, melchizedek-author, melchizedek-serve, melchizedek-memory, melchizedek-models, melchizedek-scribe; five hand-written onboarding skills, melchizedek-onboard and its four level skills, sit beside them). Refer a reader to a sibling by its name when a topic belongs there; do not repeat the sibling's content.
|
|
9
9
|
- The reader of a skill file is a coding agent (Claude Code, Codex, Cursor, OpenCode, Gemini CLI) acting for a software engineer. It reads the file when the task matches the description, then acts. Every command it might run goes in a fenced bash block, with the exact flags. Prose between commands says when to run which and what the output means. Nothing decorative.
|
|
10
10
|
|
|
11
11
|
GLOBAL LIMITS FOR SKILL FILES:
|
|
@@ -32,12 +32,14 @@ One key for every cloud provider (the gateway fallback):
|
|
|
32
32
|
- Dials: `MODEL_GATEWAY_MODEL_MAP=<your id>=<the gateway's id>` renames an id the gateway rejects; `MODEL_GATEWAY_BASE_URL` points at a self-hosted proxy.
|
|
33
33
|
- Telemetry attributes the call to the upstream provider and records the transport separately.
|
|
34
34
|
Settings per agent:
|
|
35
|
-
- `reasoning:` on the agent block, beside `model:`, sets how hard the agent reasons: `none`, `low`, `medium`, `high`, or `{ budget_tokens: 4096 }`. It reads the same on every provider; unset keeps the provider's default. The compiler sends each provider the field it reads: Gemini 3 and later get a thinking level (`none` is `MINIMAL`, then `LOW`, `MEDIUM`, `HIGH`); Gemini 2.x, and Claude 4.6 or older, get a thinking budget of 0, 2048, 8192 or 16384 tokens; every later Claude model gets adaptive thinking at an effort of `low`, `medium` or `high`, and `none` is that model's own off switch, sent at `low` effort; every other provider, and the gateway, gets an effort word, and where the provider lacks that word, its nearest setting above.
|
|
35
|
+
- `reasoning:` on the agent block, beside `model:`, sets how hard the agent reasons: `none`, `low`, `medium`, `high`, `xhigh`, `max`, or `{ budget_tokens: 4096 }`. It reads the same on every provider; unset keeps the provider's default. The compiler sends each provider the field it reads: Gemini 3 and later get a thinking level (`none` is `MINIMAL`, then `LOW`, `MEDIUM`, `HIGH`); Gemini 2.x, and Claude 4.6 or older, get a thinking budget of 0, 2048, 8192 or 16384 tokens; every later Claude model gets adaptive thinking at an effort of `low`, `medium` or `high`, and `none` is that model's own off switch, sent at `low` effort; every other provider, and the gateway, gets an effort word, and where the provider lacks that word, its nearest setting above.
|
|
36
|
+
- `xhigh` and `max` ask for more thought than `high`. They reach the models that take them: both on every later Claude model, `max` on Kimi K3 (where `xhigh` rounds up to it), and `xhigh` on GPT-5.2 and later and on grok-4.7. Every other model gets its highest setting instead, and the request's span carries `llm.reasoning.weakened`; the gateway gets `high` for any id. `npm run doctor -- --matrix` lists each path. Both cost more: `max` is Kimi K3's costliest effort.
|
|
36
37
|
- A `budget_tokens` value goes as written to Gemini and to Claude 4.6 or older, and as the smallest level that covers it everywhere else, later Claude models included. The effort word is always sent too, because the gateway can serve any cloud id; a direct provider ignores the field it does not read. Changing the `model:` line keeps the setting. Unset, a later Claude model keeps its own default: it thinks, except Opus 4.7 and 4.8, which think only when asked.
|
|
37
38
|
- Four provider limits: on Claude 4.6 or older, the adapter raises a budget under 1024 to 1024, the least Anthropic takes; on every Claude model, the Anthropic SDK refuses a non-streaming request whose output ceiling passes about 21000 tokens, and the adapter sets that ceiling to at least the thinking budget plus 2048, so a `budget_tokens` above about 19000 fails a non-streaming turn, while the levels stay under it; on Claude Opus 5 and 5.5, Fable and Mythos, `none` is adaptive thinking at `low` effort, so a little thinking remains, because Opus 5.5, Fable and Mythos cannot turn thinking off and Opus 5's off switch can write a tool call as text that never runs; Gemini 2.5 Pro rejects a budget of 0, so `none` fails on it.
|
|
38
39
|
- `sampling:` on any agent: `temperature` (where the provider still exposes it; never sent to Claude), `top_p`, `stop`, `max_output_tokens`; each adapter sends the fields its provider takes. Thinking tokens count against `max_output_tokens`, so a reasoning agent with long output needs room; the Claude adapter raises its own ceiling to the thinking budget plus 2048 tokens, on every Claude model. A level counts as its budget (2048, 8192 or 16384), so `high`, or a later Claude model that thinks by default, gets at least 18432.
|
|
40
|
+
- `tool_choice:` says which tools the model may call: `auto` (the default), `none`, `required` (some tool), or `{ name: lookup }` (that one tool). It reads the same on every provider; where a provider rejects forcing a tool, the adapter sends a weaker choice and the span carries `llm.tool_choice.weakened`.
|
|
39
41
|
- `model_overrides:` gives one provider its own prompt nuance, keyed `gemini`, `anthropic`, `openai`, `xai`, `moonshot` or `ollama`; each entry holds `instruction` (replaces the agent's instruction on that provider) or `instruction_append` (added after it). The entry for the provider of the agent's `model:` applies, and a `fallback_model` gets the same instruction.
|
|
40
|
-
- `generateContentConfig:` is the deprecated, Gemini-shaped spelling of `sampling:`, `output.mime` and `reasoning:` (as `thinkingConfig` and `reasoningEffort`). It still loads and behaves the same, with one deprecation line per file, but a `thinkingLevel` written for Gemini does nothing on Claude. An agent that sets a v2 key beside its v1 spelling fails to load. `npx melchizedek-codemod <file|dir>` rewrites a file to the v2 keys. Only `toolConfig` and
|
|
42
|
+
- `generateContentConfig:` is the deprecated, Gemini-shaped spelling of `sampling:`, `tool_choice:`, `output.mime` and `reasoning:` (as `thinkingConfig` and `reasoningEffort`). It still loads and behaves the same, with one deprecation line per file, but a `thinkingLevel` written for Gemini does nothing on Claude. An agent that sets a v2 key beside its v1 spelling fails to load. `npx melchizedek-codemod <file|dir>` rewrites a file to the v2 keys. Only `toolConfig.functionCallingConfig.mode: VALIDATED` and Gemini's dynamic budget (`thinkingBudget: -1`) still need `generateContentConfig:`; the codemod drops `includeThoughts`. `topK`, `seed`, the penalties, `candidateCount`, `safetySettings` and `includeThoughts` reach no provider; the Gemini adapter asks for the thought trace itself whenever `reasoning:` is not `none`.
|
|
41
43
|
- The framework's own pattern: data-gathering subagents on a lite model with `reasoning: none` and a tight output cap; synthesis on the stronger model with `reasoning: low` or higher and room to reason. The templates in `config/agents/templates/` follow it.
|
|
42
44
|
Mixing providers in one syndicate:
|
|
43
45
|
- Any agent in a graph can run on a different provider; `model_zoo.yaml` declares one lightweight agent per provider, and in a clone `npm run demo:models` sends one prompt through each.
|
|
@@ -6,7 +6,7 @@ STRUCTURE (exact): an H1 `# Melchizedek agent skills`, then `##` sections in thi
|
|
|
6
6
|
|
|
7
7
|
FACTS:
|
|
8
8
|
What this is:
|
|
9
|
-
- A suite of
|
|
9
|
+
- A suite of eleven Agent Skills (the open SKILL.md standard: one directory per skill, a SKILL.md with `name` and `description` frontmatter, optional supporting files) that teach a coding agent how to onboard a person from the credentials they have, and how to find, run, author, serve, remember with, and write with Melchizedek syndicates. They ship in the npm package melchizedek-agents and in the public repository, in `skills/`.
|
|
10
10
|
The skills (name → what it teaches):
|
|
11
11
|
- `melchizedek` → the entry point: where the syndicates are, what each starter-pack file does and costs, the doctor, running one interactively or one shot, and delegating a task from a coding agent.
|
|
12
12
|
- `melchizedek-author` → designing or editing a syndicate YAML: layout, keys, instruction anatomy, tools by name, the two constraints that break a file, offline validation.
|
|
@@ -14,6 +14,8 @@ The skills (name → what it teaches):
|
|
|
14
14
|
- `melchizedek-memory` → Supabase sessions and long-term memory: modes, schema, tools, extraction rules, inspection, erasure.
|
|
15
15
|
- `melchizedek-models` → model ids and providers, keys, keyless Ollama, the gateway fallback, per-agent settings, the errors.
|
|
16
16
|
- `melchizedek-scribe` → writing documents from a brief with the Scribe syndicate.
|
|
17
|
+
- Five onboarding skills, written by hand rather than by the Scribe (they print their facts from `npx melchizedek-setup --level <id>`): `melchizedek-onboard` (triage to one of ten authentication levels), `melchizedek-onboard-local`, `melchizedek-onboard-keys`, `melchizedek-onboard-cloud`, `melchizedek-onboard-serve`.
|
|
18
|
+
- `--agents-md` also writes a pointer block into the project's `AGENTS.md`.
|
|
17
19
|
Install (three ways):
|
|
18
20
|
- From the package, into this project's `.claude/skills/` and `.agents/skills/` (the two locations that between them reach Claude Code, Codex, Cursor, OpenCode and Gemini CLI): `npx melchizedek-skills install` after `npm install melchizedek-agents`. `--for <targets>` picks platforms from `claude, agents, codex, cursor, opencode, gemini, all`; `--global` writes the home-directory locations instead; `--dir <path>` writes one explicit directory; `--only <names>` installs a subset; `--force` overwrites a file that differs; `--dry-run` prints without writing. `npx melchizedek-skills paths` prints the locations; `npx melchizedek-skills list` prints the skills. In a clone: `npm run skills:install -- <same flags>`.
|
|
19
21
|
- With the skills CLI from the public repository: `npx skills add jhwadman/melch-ai` lists the skills and installs the ones you choose into the agents you choose.
|
|
@@ -107,7 +107,7 @@ The runtime telemetry attributes every call to the upstream provider and records
|
|
|
107
107
|
|
|
108
108
|
## Settings per agent
|
|
109
109
|
|
|
110
|
-
Set how hard an agent reasons with `reasoning:` on the agent block, beside `model:`. It takes `none`, `low`, `medium`, `high`, or `{ budget_tokens: 4096 }`, and reads the same on every provider. Leave it unset to keep the provider's default. The compiler sends each provider the field that provider reads:
|
|
110
|
+
Set how hard an agent reasons with `reasoning:` on the agent block, beside `model:`. It takes `none`, `low`, `medium`, `high`, `xhigh`, `max`, or `{ budget_tokens: 4096 }`, and reads the same on every provider. Leave it unset to keep the provider's default. The compiler sends each provider the field that provider reads:
|
|
111
111
|
|
|
112
112
|
| Provider | What `reasoning:` becomes |
|
|
113
113
|
| --- | --- |
|
|
@@ -116,6 +116,8 @@ Set how hard an agent reasons with `reasoning:` on the agent block, beside `mode
|
|
|
116
116
|
| Every later Claude model | adaptive thinking at an effort of `low`, `medium` or `high`; `none` is the model's own off switch, sent at `low` effort |
|
|
117
117
|
| Every other provider, and the gateway | an effort word; where the provider lacks that word, its nearest setting above |
|
|
118
118
|
|
|
119
|
+
`xhigh` and `max` ask for more thought than `high`. They reach the models that take them: both on every later Claude model, `max` on Kimi K3 (where `xhigh` rounds up to it), and `xhigh` on GPT-5.2 and later and on grok-4.7. Every other model gets its highest setting instead, and the request's span carries `llm.reasoning.weakened`; the gateway gets `high` for any id. `npm run doctor -- --matrix` lists each path. Both cost more: `max` is Kimi K3's costliest effort.
|
|
120
|
+
|
|
119
121
|
A `budget_tokens` value goes as written to Gemini and to Claude 4.6 or older, and as the smallest level that covers it everywhere else, later Claude models included. Because the gateway can serve any cloud id, the effort word is always sent as well, and a direct provider ignores the field it does not read. Change the `model:` line and the setting carries over. Unset, a later Claude model keeps its own default: it thinks, except Opus 4.7 and 4.8, which think only when asked.
|
|
120
122
|
|
|
121
123
|
Four limits apply. On Claude 4.6 or older, the adapter raises a budget under 1024 to 1024, the least Anthropic takes. On every Claude model, the Anthropic SDK refuses a non-streaming request whose output ceiling passes about 21000 tokens. The adapter sets that ceiling to at least the thinking budget plus 2048, so a `budget_tokens` above about 19000 fails a non-streaming turn. The levels stay under it. On Claude Opus 5 and 5.5, Fable and Mythos, `none` is adaptive thinking at `low` effort, so a little thinking remains: Opus 5.5, Fable and Mythos cannot turn thinking off, and Opus 5's off switch can write a tool call as text that never runs. Gemini 2.5 Pro rejects a budget of 0, so `none` fails on it.
|
|
@@ -125,9 +127,11 @@ You can configure sampling under `sampling:` on any agent in the syndicate YAML,
|
|
|
125
127
|
- `top_p` and `stop`: nucleus sampling and stop sequences.
|
|
126
128
|
- `max_output_tokens`: caps total token generation. Thinking tokens count against it, so a reasoning agent with long output needs room. The Claude adapter raises its own ceiling to the thinking budget plus 2048 tokens, on every Claude model. A level counts as its budget (2048, 8192 or 16384), so `high`, or a later Claude model that thinks by default, gets at least 18432.
|
|
127
129
|
|
|
130
|
+
`tool_choice:` says which tools the model may call: `auto` (the default), `none`, `required` (some tool), or `{ name: lookup }` (that one tool). It reads the same on every provider. Where a provider rejects forcing a tool, the adapter sends a weaker choice and the span carries `llm.tool_choice.weakened`.
|
|
131
|
+
|
|
128
132
|
`model_overrides:` gives one provider its own prompt nuance. Key it by `gemini`, `anthropic`, `openai`, `xai`, `moonshot`, or `ollama`; each entry holds `instruction`, which replaces the agent instruction on that provider, or `instruction_append`, which adds text after it. The entry for the provider of the agent `model:` applies, and a `fallback_model` gets the same instruction.
|
|
129
133
|
|
|
130
|
-
`generateContentConfig:` is the deprecated, Gemini-shaped spelling of `sampling:`, `output.mime`, and `reasoning:` (as `thinkingConfig` and `reasoningEffort`). It still loads and behaves the same, with one deprecation line per file, but a `thinkingLevel` written for Gemini does nothing on Claude. An agent that sets a v2 key beside its v1 spelling fails to load. `npx melchizedek-codemod <file|dir>` rewrites a file to the v2 keys. Only `toolConfig` and
|
|
134
|
+
`generateContentConfig:` is the deprecated, Gemini-shaped spelling of `sampling:`, `tool_choice:`, `output.mime`, and `reasoning:` (as `thinkingConfig` and `reasoningEffort`). It still loads and behaves the same, with one deprecation line per file, but a `thinkingLevel` written for Gemini does nothing on Claude. An agent that sets a v2 key beside its v1 spelling fails to load. `npx melchizedek-codemod <file|dir>` rewrites a file to the v2 keys. Only `toolConfig.functionCallingConfig.mode: VALIDATED` and Gemini's dynamic budget (`thinkingBudget: -1`) still need `generateContentConfig:`; the codemod drops `includeThoughts`. `topK`, `seed`, the penalties, `candidateCount`, `safetySettings`, and `includeThoughts` reach no provider; the Gemini adapter asks for the thought trace itself whenever `reasoning:` is not `none`.
|
|
131
135
|
|
|
132
136
|
The framework's own pattern places data-gathering subagents on a lite model with `reasoning: none` and a tight output cap, while synthesis runs on a stronger model with `reasoning: low` or higher and room to reason. The templates in `config/agents/templates/` follow it.
|
|
133
137
|
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: melchizedek-onboard
|
|
3
|
+
description: "Onboard a person to Melchizedek from whatever credentials they have: ask what they have (nothing, one or several provider API keys, a gateway key, Vertex AI / Bedrock / Azure access, a server to put in front of other people, OAuth tools, a ChatGPT plan to use on their own machine, or a Codex, Claude.ai or Gemini CLI sign-in), route them to one authentication level, and walk its startup guide without ever handling a key. Use when someone is setting up melchizedek-agents for the first time, asks which keys they need, says 'I have an X key', 'I have ChatGPT Plus' or 'I have a Codex login', or asks how to get started."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## What this skill does
|
|
7
|
+
|
|
8
|
+
It turns "what do you have?" into one of ten authentication levels and the startup guide for it. The guides are generated by the engine itself, so you print them instead of restating them:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx melchizedek-setup --list # the ten levels
|
|
12
|
+
npx melchizedek-setup --level <id|number> # one level's guide
|
|
13
|
+
npx melchizedek-setup --auto # detect from the environment, names only
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
In a clone of the repository, use `npm run setup -- <flags>` instead of `npx melchizedek-setup`. The same guides are in `ONBOARDING.md`.
|
|
17
|
+
|
|
18
|
+
## The rules that never bend
|
|
19
|
+
|
|
20
|
+
- Never ask the person to paste a key, token or secret into the chat, and never read one from their files or shell history. A pasted key lives in the transcript forever.
|
|
21
|
+
- Never print a value from `.env`. To check what is set, run `npx melchizedek-setup --auto` or `npx melchizedek-doctor`; both report names and set or unset only.
|
|
22
|
+
- The person types every value into `.env` in their own editor. You may create `.env` with names left blank: `npx melchizedek-setup --level <id> --write-env`. It never overwrites an existing `.env` and refuses unless git ignores `.env`.
|
|
23
|
+
- Never reuse another app's sign-in (the Codex CLI's login, Claude.ai, Gemini CLI) as a model credential, and never read its token files. Route that person to level 10, which names the sanctioned alternative.
|
|
24
|
+
- A ChatGPT plan is used only through the engine's own Sign in with ChatGPT (level 9): the person runs `npx melchizedek-setup --chatgpt-signin` and approves in their own browser. It is for their own machine only; never set it up for a server.
|
|
25
|
+
|
|
26
|
+
## Triage
|
|
27
|
+
|
|
28
|
+
1. Run `npx melchizedek-setup --auto`. If it already detects a level beyond 1, confirm with the person that this is what they want and continue from that guide.
|
|
29
|
+
2. Otherwise ask one question: "What do you have: nothing yet, an API key from a model provider, a gateway key, cloud platform access, a ChatGPT plan, or a Claude or Gemini sign-in? And will other people or backends call your agents?"
|
|
30
|
+
3. Route by the answer:
|
|
31
|
+
|
|
32
|
+
| They have | Level | Follow |
|
|
33
|
+
|---|---|---|
|
|
34
|
+
| Nothing, or want everything on their machine | 1 `local` | `melchizedek-onboard-local` |
|
|
35
|
+
| One key from Google AI Studio, Anthropic, OpenAI, xAI or Moonshot | 2 `one-provider` | `melchizedek-onboard-keys` |
|
|
36
|
+
| Keys from several of those | 3 `several-providers` | `melchizedek-onboard-keys` |
|
|
37
|
+
| A Vercel AI Gateway or OpenRouter key | 4 `gateway` | `melchizedek-onboard-keys` |
|
|
38
|
+
| Google Cloud (Vertex AI), AWS (Bedrock) or Azure OpenAI access | 5 `cloud-platform` | `melchizedek-onboard-cloud` |
|
|
39
|
+
| Callers who fund their own model calls | 6 `byok` | `melchizedek-onboard-serve` |
|
|
40
|
+
| Other backends or users calling the server | 7 `caller-tokens` | `melchizedek-onboard-serve` |
|
|
41
|
+
| Tools that act for each user on a third-party API | 8 `oauth-grants` | `melchizedek-onboard-serve` |
|
|
42
|
+
| A ChatGPT plan, to use on their own machine | 9 `chatgpt-signin` | `melchizedek-onboard-keys` |
|
|
43
|
+
| A Codex CLI login, a Claude.ai or a Gemini CLI sign-in only | 10 `subscription-signin` | `melchizedek-onboard-keys` |
|
|
44
|
+
|
|
45
|
+
Levels 6 to 8 sit on top of a model level (1 to 5): settle how models are paid for first.
|
|
46
|
+
|
|
47
|
+
4. Print the level's guide with `--level <id>` and walk it step by step: the person sets the variables, you run the doctor command the guide names and read its verdicts back to them, then you run the first command.
|
|
48
|
+
|
|
49
|
+
## Use melch from Claude Code or Codex
|
|
50
|
+
|
|
51
|
+
Once a level is confirmed, the person can call their syndicates from inside their coding agent: `melchizedek-mcp` makes each syndicate an MCP tool (`{ message, session_id? }`), plus `melch_resume` for a turn that pauses. Register it from the project directory, where `.env` and `config/agents/` live:
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
claude mcp add melch -- npx melchizedek-mcp --syndicate <id>
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
For Codex, add to `~/.codex/config.toml`:
|
|
58
|
+
|
|
59
|
+
```toml
|
|
60
|
+
[mcp_servers.melch]
|
|
61
|
+
command = "npx"
|
|
62
|
+
args = ["-y", "-p", "melchizedek-agents", "melchizedek-mcp", "--syndicate", "<id>"]
|
|
63
|
+
cwd = "/path/to/the/project"
|
|
64
|
+
tool_timeout_sec = 900
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
When a result says an approval is waiting, ask the person and pass their decision to `melch_resume` with `approve`; never approve on their behalf. Keys stay in `.env`: the MCP registration names no key.
|
|
68
|
+
|
|
69
|
+
## Done when
|
|
70
|
+
|
|
71
|
+
The doctor shows the level's confirmation (the guide's **Confirm** line), and the first command has answered once. Then hand over to the `melchizedek` skill for the catalog of syndicates.
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: melchizedek-onboard-cloud
|
|
3
|
+
description: "Onboard a person to Melchizedek through their cloud account instead of vendor API keys: Gemini or Claude on Google Vertex AI (Application Default Credentials), Claude on Amazon Bedrock (the AWS credential chain), or GPT on Azure OpenAI (an Azure key or Entra ID). Use when someone has a Google Cloud project, AWS access, or an Azure OpenAI resource, needs data to stay in their cloud, or sees an endpoint problem from the doctor."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## The level
|
|
7
|
+
|
|
8
|
+
Level 5, `cloud-platform`. The model id still picks the provider; `GEMINI_PLATFORM`, `ANTHROPIC_PLATFORM` and `OPENAI_PLATFORM` pick the cloud it is reached through. Print the guide first:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx melchizedek-setup --level cloud-platform # in a clone: npm run setup -- --level cloud-platform
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Steps per cloud
|
|
15
|
+
|
|
16
|
+
The person signs in to their cloud with that cloud's own tools; you never handle the credential.
|
|
17
|
+
|
|
18
|
+
- **Gemini on Vertex AI.** They run `gcloud auth application-default login` (or the deployment uses a service account). In `.env`: `GEMINI_PLATFORM=vertex`, `GOOGLE_CLOUD_PROJECT`, `GOOGLE_CLOUD_LOCATION`.
|
|
19
|
+
- **Claude on Vertex AI.** `npm install @anthropic-ai/vertex-sdk`. In `.env`: `ANTHROPIC_PLATFORM=vertex`, `ANTHROPIC_VERTEX_PROJECT_ID` (or `GOOGLE_CLOUD_PROJECT`), `CLOUD_ML_REGION` (or `GOOGLE_CLOUD_LOCATION`). Credentials are Google ADC, as above.
|
|
20
|
+
- **Claude on Amazon Bedrock.** `npm install @anthropic-ai/bedrock-sdk`. In `.env`: `ANTHROPIC_PLATFORM=bedrock`, `AWS_REGION`. Credentials come from the AWS chain (a profile, SSO, or the instance role). Bedrock model ids differ from Anthropic's: map them with `ANTHROPIC_MODEL_MAP` (a JSON object of YAML id to Bedrock id).
|
|
21
|
+
- **GPT on Azure OpenAI.** In `.env`: `OPENAI_PLATFORM=azure`, `AZURE_OPENAI_ENDPOINT`, and either `AZURE_OPENAI_API_KEY` or Entra ID (`npm install @azure/identity`, then `az login` or a managed identity). Map YAML ids to deployment names with `OPENAI_MODEL_MAP`.
|
|
22
|
+
|
|
23
|
+
Use `npx melchizedek-setup --level cloud-platform --write-env` to create `.env` with these names blank when there is none.
|
|
24
|
+
|
|
25
|
+
## Confirm
|
|
26
|
+
|
|
27
|
+
Run `npx melchizedek-doctor`. Each provider on a cloud prints one `endpoint` line; a ✗ names the missing variable or the uninstalled SDK. The doctor does not exercise the cloud's credential chain, so the first command is the real test:
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
npx melchizedek-init --template research_brief # Gemini; for Claude use the claude example
|
|
31
|
+
npx melchizedek-chat --syndicate research_brief
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Say this up front
|
|
35
|
+
|
|
36
|
+
- These paths are tested against mocks and have not been run against the live clouds from the engine's repository; the doctor says so.
|
|
37
|
+
- Anthropic's and OpenAI's server-side `web_search` are not sent on Bedrock, Claude on Vertex AI or Azure. Gemini grounding works on Vertex AI.
|
|
38
|
+
- Model availability differs by region: a `Model not found` usually means the region or the model map, not the code.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: melchizedek-onboard-keys
|
|
3
|
+
description: "Onboard a person to Melchizedek with provider API keys: one key (Gemini, Anthropic, OpenAI, xAI or Moonshot), several, or one Vercel AI Gateway / OpenRouter key, or their ChatGPT plan on their own machine through Sign in with ChatGPT, and answer honestly when they only have a Codex, Claude.ai or Gemini CLI sign-in. Use when someone says 'I have an OpenAI key', 'I have keys for Claude and Gemini', 'I have an OpenRouter key', 'I have ChatGPT Plus', 'can I use my Codex login', or asks which key unlocks which syndicate."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## The levels
|
|
7
|
+
|
|
8
|
+
| Level | Id | Guide |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| 2 | `one-provider` | one provider's key funds every agent on that provider |
|
|
11
|
+
| 3 | `several-providers` | each key funds its own provider; a syndicate may mix them |
|
|
12
|
+
| 4 | `gateway` | one gateway key serves every cloud id whose direct key is absent |
|
|
13
|
+
| 9 | `chatgpt-signin` | Sign in with ChatGPT: OpenAI ids on the person's ChatGPT plan, on their own machine only |
|
|
14
|
+
| 10 | `subscription-signin` | another app's sign-in is not a model credential; the sanctioned route instead |
|
|
15
|
+
|
|
16
|
+
Print the guide for the level before you start: `npx melchizedek-setup --level <id>` (in a clone, `npm run setup -- --level <id>`).
|
|
17
|
+
|
|
18
|
+
## Steps for a key (levels 2 to 4)
|
|
19
|
+
|
|
20
|
+
1. Create `.env` with the names left blank, if there is none: `npx melchizedek-setup --level <id> --write-env`. It refuses unless git ignores `.env`; if it refuses, add `.env` to `.gitignore` first.
|
|
21
|
+
2. Tell the person which variable to fill in and where the key comes from (the guide's table: Google AI Studio, the Anthropic console, the OpenAI platform, the xAI console, the Moonshot platform, Vercel or OpenRouter). They open `.env` in their editor and type the value. Never ask for it in chat.
|
|
22
|
+
3. Run `npx melchizedek-doctor`. Read the providers line back: a ✓ beside each provider they set, `◇ via gateway` for providers served by the gateway. Each blocked file names the one variable that would unblock it.
|
|
23
|
+
4. Run the guide's first commands. With a Gemini key, `research_brief` is a good first template; with only an Anthropic key, `claude` is the shipped example; for any other provider, change a template's `model:` lines to that provider's ids and run the doctor again.
|
|
24
|
+
|
|
25
|
+
## What to tell them about the gateway
|
|
26
|
+
|
|
27
|
+
It is a fallback, never a preempt: a direct key set beside it wins for its provider. On the gateway path, native search is dropped (Gemini grounding, Anthropic and OpenAI `web_search`, xAI `x_search`), and long-term memory's embedder still needs `GOOGLE_GENAI_API_KEY` (or `MEMORY_EMBEDDING_PROVIDER=openai` or `ollama`). A model id the gateway rejects is fixed with `MODEL_GATEWAY_MODEL_MAP`, not in code.
|
|
28
|
+
|
|
29
|
+
## Sign in with ChatGPT (level 9, local only)
|
|
30
|
+
|
|
31
|
+
OpenAI documents a plan-usage sign-in for open-source apps that run on the user's own machine, and the engine implements it as its own app registration.
|
|
32
|
+
|
|
33
|
+
1. The person runs `npx melchizedek-setup --chatgpt-signin` (in a clone, `npm run setup -- --chatgpt-signin`) and approves in their own browser. You never see, copy or move the stored tokens; they live outside the repository, mode 600.
|
|
34
|
+
2. `OPENAI_API_KEY` must be blank for the sign-in to carry OpenAI ids; a key wins.
|
|
35
|
+
3. Run `npx melchizedek-doctor`: the providers line shows `ChatGPT sign-in, local only`, and the `chatgpt` line reads `signed in · carries OpenAI ids · local only`.
|
|
36
|
+
4. Point a syndicate's `model:` lines at a GPT id their ChatGPT account offers, then chat.
|
|
37
|
+
|
|
38
|
+
Tell them: it is a preview (the Responses API only, streamed, no temperature or output-token cap), their plan's usage limits apply, and it is for their machine only. `melchizedek-serve` and `melchizedek-worker` refuse to start on it; a server needs `OPENAI_API_KEY` or Azure OpenAI. Sign out with `--chatgpt-signout`.
|
|
39
|
+
|
|
40
|
+
## A subscription sign-in (level 10)
|
|
41
|
+
|
|
42
|
+
Say plainly what is and is not possible, then route:
|
|
43
|
+
|
|
44
|
+
- A Codex CLI login, a Claude.ai or a Gemini CLI sign-in pays for that vendor's own apps. The engine does not read, reuse or relay those tokens, and you must not wire one in or read their files.
|
|
45
|
+
- Anthropic and Google state that third-party software may not use those sign-ins. For OpenAI, the sanctioned way to use a ChatGPT plan is level 9, the engine's own Sign in with ChatGPT; copying the Codex CLI's token is not that flow.
|
|
46
|
+
- The sanctioned routes: an API key from the same vendor (level 2), or its cloud platform (Bedrock or Vertex AI for Claude, Vertex AI for Gemini, Azure OpenAI for GPT; level 5, `melchizedek-onboard-cloud`). Google AI Studio has a free tier, and local models need nothing (level 1).
|
|
47
|
+
- The sign-in still has a use here: it pays for the coding agent (you) that drives this repository.
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: melchizedek-onboard-local
|
|
3
|
+
description: "Onboard a person to Melchizedek with no API key at all: install Ollama, pull an open-weight model, and run the keyless syndicates entirely on their machine. Use when someone has no provider key, wants nothing to leave their machine, asks for the free or offline path, or meets OLLAMA_UNREACHABLE."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## The level
|
|
7
|
+
|
|
8
|
+
Level 1, `local`. Every agent whose model id starts with `ollama/` runs through Ollama's OpenAI-compatible endpoint on the person's machine. No account, no key. Print the current guide first:
|
|
9
|
+
|
|
10
|
+
```bash
|
|
11
|
+
npx melchizedek-setup --level local # in a clone: npm run setup -- --level local
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
## Steps
|
|
15
|
+
|
|
16
|
+
1. Check Node.js: `node --version` must be 22.6 or newer.
|
|
17
|
+
2. The person installs Ollama from https://ollama.com (an installer is theirs to run). Then:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
ollama pull qwen3:8b
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
3. In a project that installed the package, copy the keyless template; in a clone, the keyless examples are already there:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
npx melchizedek-init --template conversational
|
|
27
|
+
npx melchizedek-chat --syndicate conversational
|
|
28
|
+
# clone: npm run syndicate:assistant (or syndicate:tutor, syndicate:council)
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
4. Confirm with the doctor (`npx melchizedek-doctor`, or `npm run doctor` in a clone): the providers line shows `Ollama (local) local`, and the keyless files read `ready — local, no key`.
|
|
32
|
+
|
|
33
|
+
## When it fails
|
|
34
|
+
|
|
35
|
+
- `OLLAMA_UNREACHABLE`: Ollama is not running. Start the app or `ollama serve`, then `ollama list` to see the model is pulled.
|
|
36
|
+
- An answer that stops mid-page on a summarizing task: Ollama's default context is 4,096 tokens. Restart it with `OLLAMA_CONTEXT_LENGTH=16384 ollama serve`.
|
|
37
|
+
- A different Ollama host: set `OLLAMA_BASE_URL` (shape `http://host:11434/v1`) in `.env`. No key is involved.
|
|
38
|
+
|
|
39
|
+
## Next
|
|
40
|
+
|
|
41
|
+
Server-side search tools are not available locally. When the person gets a provider key, switch to `melchizedek-onboard-keys`; the keyless files keep working beside it.
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: melchizedek-onboard-serve
|
|
3
|
+
description: "Onboard an operator who will serve Melchizedek agents to other people or backends over A2A: who pays for model calls (the server's keys or each caller's own, BYOK), who a caller is (A2A_AUTH: caller tokens, JWT, a gateway header, or one shared secret), the public-URL posture, and OAuth tool grants that act for each end user. Use when someone asks to deploy or expose the server, to let customers bring their own key, to issue tokens to calling backends, or to connect a tool to a user's third-party account."
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
## The levels
|
|
7
|
+
|
|
8
|
+
| Level | Id | Settles |
|
|
9
|
+
|---|---|---|
|
|
10
|
+
| 6 | `byok` | callers fund their own model calls with `X-API-Key` and `X-Provider` |
|
|
11
|
+
| 7 | `caller-tokens` | who a caller is: `A2A_AUTH=callers`, `jwt`, `header` or `secret` |
|
|
12
|
+
| 8 | `oauth-grants` | tools that send a third-party token for each end user |
|
|
13
|
+
|
|
14
|
+
They sit on top of a model level (1 to 5): settle how the server's own models are paid for first. Print a guide with `npx melchizedek-setup --level <id>` (in a clone, `npm run setup -- --level <id>`).
|
|
15
|
+
|
|
16
|
+
## Identity first (level 7)
|
|
17
|
+
|
|
18
|
+
1. Pick the mode with the operator. Prefer `callers` (one token per calling backend) or `jwt` (their identity provider) on anything public. `header` is for an authenticating gateway in front. `secret` is one shared secret: any holder can act as any user.
|
|
19
|
+
2. For `callers`, mint a token per backend so it never lands in a transcript:
|
|
20
|
+
|
|
21
|
+
```bash
|
|
22
|
+
npx melchizedek-serve --new-caller my-backend --token-file "$HOME/my-backend.token"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
It writes the token to a new mode-600 file and prints only the `A2A_CALLERS` entry, which holds the token's SHA-256. The operator adds that entry to `.env`, moves the token into the calling backend's secret store, and deletes the file. Do not run `--new-caller` without `--token-file` in an agent session.
|
|
26
|
+
3. On a public deployment, `PUBLIC_URL` makes the server refuse to start until `A2A_AUTH`, `A2A_SERVED_AGENTS` and `A2A_TRUST_PROXY` are set explicitly. That is intended; set them, do not work around it.
|
|
27
|
+
4. Run `npx melchizedek-doctor`: the `serving` line names the mode and, with a ✗, any variable the server would stop on.
|
|
28
|
+
|
|
29
|
+
## Who pays (level 6)
|
|
30
|
+
|
|
31
|
+
`A2A_KEY_MODE=byok` makes each caller's `X-API-Key` fund agents on the provider named by `X-Provider`. Agents on other providers, tools and memory extraction still use the server's keys. Under `A2A_AUTH=secret` only, byok also scopes data by a hash of the caller's key; with caller tokens or JWTs, the identity scopes data and byok only pays.
|
|
32
|
+
|
|
33
|
+
## OAuth tool grants (level 8)
|
|
34
|
+
|
|
35
|
+
1. The operator generates the sealing key themselves (`openssl rand -base64 32`) and types it into `MELCHIZEDEK_CREDENTIAL_KEY`. It must stay out of the database and its backups.
|
|
36
|
+
2. `OAUTH_REDIRECT_URI` is the https callback registered at every provider, with no query string.
|
|
37
|
+
3. `MELCHIZEDEK_OAUTH_HOSTS` binds each provider to the hosts its tokens may reach (`provider=host,host;provider=host`). Unset, authorization-code grants are refused.
|
|
38
|
+
4. The default callback identity (`OAUTH_CALLBACK_IDENTITY=required`) needs `A2A_AUTH=header` behind a gateway; `state` relaxes it, and a forwarded consent link can then connect the wrong account. Say so before choosing it.
|
|
39
|
+
5. Each grant's client id and secret come from variables the YAML names; the doctor lists them by name for every `⚿` line. `systems_operator` carries a commented `mcp_auth` block to start from.
|
|
40
|
+
|
|
41
|
+
## Done when
|
|
42
|
+
|
|
43
|
+
The doctor's `serving` (and, for level 8, `oauth`) lines show no ✗, the server starts, and one authenticated call answers: `node demo/a2a_demo.mjs` is a two-turn client for the secret mode.
|