melchizedek-agents 1.1.0 → 1.2.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.
Files changed (118) hide show
  1. package/.env.example +10 -0
  2. package/AGENT_SETUP.md +3 -1
  3. package/CHANGELOG.md +232 -0
  4. package/DOCUMENTATION.md +91 -16
  5. package/ONBOARDING.md +339 -0
  6. package/QUICKSTART.md +15 -2
  7. package/README.md +5 -2
  8. package/config/agents/examples/council.yaml +1 -1
  9. package/config/agents/examples/critic.yaml +8 -8
  10. package/config/agents/examples/image_production.yaml +4 -3
  11. package/config/agents/syndicate.schema.json +65 -7
  12. package/config/agents/syndicateSchema.yaml +18 -6
  13. package/config/agents/templates/intake_extractor.yaml +3 -2
  14. package/config/agents/templates/systems_operator.yaml +5 -2
  15. package/dist/lib/a2a/app.d.ts +12 -0
  16. package/dist/lib/a2a/app.js +22 -11
  17. package/dist/lib/a2a/executor.js +14 -6
  18. package/dist/lib/a2a/oauthSetup.d.ts +16 -0
  19. package/dist/lib/a2a/oauthSetup.js +57 -3
  20. package/dist/lib/agentDialect.d.ts +18 -8
  21. package/dist/lib/agentDialect.js +36 -19
  22. package/dist/lib/compile.d.ts +38 -7
  23. package/dist/lib/compile.js +57 -37
  24. package/dist/lib/compileNative.d.ts +11 -3
  25. package/dist/lib/compileNative.js +18 -1
  26. package/dist/lib/doctor.d.ts +76 -0
  27. package/dist/lib/doctor.js +159 -7
  28. package/dist/lib/loadSyndicate.d.ts +9 -0
  29. package/dist/lib/models/capabilities.d.ts +9 -0
  30. package/dist/lib/models/capabilities.js +24 -0
  31. package/dist/lib/models/chatCompletionsAdapter.d.ts +11 -3
  32. package/dist/lib/models/chatCompletionsAdapter.js +19 -5
  33. package/dist/lib/models/claudeAdapter.js +4 -0
  34. package/dist/lib/models/contract.d.ts +5 -2
  35. package/dist/lib/models/gateway.d.ts +2 -1
  36. package/dist/lib/models/gateway.js +4 -2
  37. package/dist/lib/models/gatewayAdapter.d.ts +7 -1
  38. package/dist/lib/models/gatewayAdapter.js +8 -0
  39. package/dist/lib/models/geminiAdapter.js +8 -2
  40. package/dist/lib/models/genaiMapping.d.ts +8 -4
  41. package/dist/lib/models/genaiMapping.js +23 -9
  42. package/dist/lib/models/gptAdapter.d.ts +4 -2
  43. package/dist/lib/models/gptAdapter.js +11 -4
  44. package/dist/lib/models/grokAdapter.d.ts +3 -1
  45. package/dist/lib/models/grokAdapter.js +11 -3
  46. package/dist/lib/models/kimiAdapter.d.ts +2 -1
  47. package/dist/lib/models/kimiAdapter.js +3 -3
  48. package/dist/lib/models/reasoning.d.ts +30 -2
  49. package/dist/lib/models/reasoning.js +56 -5
  50. package/dist/lib/onboarding.d.ts +134 -0
  51. package/dist/lib/onboarding.js +539 -0
  52. package/dist/lib/runtime/approvals.d.ts +2 -0
  53. package/dist/lib/runtime/approvals.js +4 -3
  54. package/dist/lib/runtime/credentials.d.ts +6 -0
  55. package/dist/lib/runtime/native/agentLoop.d.ts +5 -2
  56. package/dist/lib/runtime/native/agentLoop.js +2 -0
  57. package/dist/lib/runtime/native/checkpoint.d.ts +12 -5
  58. package/dist/lib/runtime/native/checkpoint.js +13 -19
  59. package/dist/lib/runtime/native/delegate.d.ts +82 -1
  60. package/dist/lib/runtime/native/delegate.js +157 -2
  61. package/dist/lib/runtime/native/interrupts.d.ts +88 -5
  62. package/dist/lib/runtime/native/interrupts.js +220 -30
  63. package/dist/lib/runtime/syndicateTurn.d.ts +4 -2
  64. package/dist/lib/runtime/syndicateTurn.js +295 -62
  65. package/dist/lib/runtime/turnControl.d.ts +41 -0
  66. package/dist/lib/session/transcript.d.ts +9 -0
  67. package/dist/lib/session/transcript.js +20 -1
  68. package/dist/lib/skills.d.ts +18 -0
  69. package/dist/lib/skills.js +73 -1
  70. package/dist/lib/storage/postgres/index.d.ts +6 -1
  71. package/dist/lib/storage/postgres/index.js +1 -1
  72. package/dist/lib/storage/postgres/taskQueue.d.ts +7 -3
  73. package/dist/lib/storage/postgres/taskQueue.js +10 -3
  74. package/dist/lib/syndicateSchema.d.ts +38 -1
  75. package/dist/lib/syndicateSchema.js +25 -18
  76. package/dist/lib/tools/auth.d.ts +13 -1
  77. package/dist/lib/tools/auth.js +10 -2
  78. package/dist/lib/tools/credentialHosts.d.ts +88 -0
  79. package/dist/lib/tools/credentialHosts.js +165 -0
  80. package/dist/lib/tools/credentialUses.d.ts +92 -0
  81. package/dist/lib/tools/credentialUses.js +112 -0
  82. package/dist/lib/tools/mcpToolFactory.js +1 -1
  83. package/dist/lib/tools/oauthConsent.js +8 -1
  84. package/dist/lib/tools/oauthHosts.d.ts +2 -0
  85. package/dist/lib/tools/oauthHosts.js +2 -2
  86. package/dist/lib/tools/oauthTools.d.ts +10 -1
  87. package/dist/lib/tools/oauthTools.js +29 -3
  88. package/dist/lib/tools/openapiTools.d.ts +7 -0
  89. package/dist/lib/tools/openapiTools.js +49 -3
  90. package/dist/lib/tools/taskTools.d.ts +32 -2
  91. package/dist/lib/tools/taskTools.js +93 -33
  92. package/dist/lib/workflow/turn.d.ts +22 -3
  93. package/dist/lib/workflow/turn.js +151 -31
  94. package/dist/lib/workflow.d.ts +10 -7
  95. package/dist/lib/workflow.js +10 -7
  96. package/dist/scripts/a2a_server.d.ts +2 -2
  97. package/dist/scripts/a2a_server.js +11 -2
  98. package/dist/scripts/assistant_worker.d.ts +2 -0
  99. package/dist/scripts/assistant_worker.js +13 -4
  100. package/dist/scripts/doctor.d.ts +4 -2
  101. package/dist/scripts/doctor.js +6 -4
  102. package/dist/scripts/setup.d.ts +23 -0
  103. package/dist/scripts/setup.js +154 -0
  104. package/dist/scripts/skills_install.d.ts +3 -1
  105. package/dist/scripts/skills_install.js +17 -2
  106. package/dist/scripts/yaml_codemod.d.ts +12 -2
  107. package/dist/scripts/yaml_codemod.js +115 -33
  108. package/package.json +4 -1
  109. package/skills/README.md +11 -2
  110. package/skills/briefs/_shared.md +1 -1
  111. package/skills/briefs/melchizedek-models.md +4 -2
  112. package/skills/briefs/skills-readme.md +3 -1
  113. package/skills/melchizedek-models/SKILL.md +6 -2
  114. package/skills/melchizedek-onboard/SKILL.md +49 -0
  115. package/skills/melchizedek-onboard-cloud/SKILL.md +38 -0
  116. package/skills/melchizedek-onboard-keys/SKILL.md +35 -0
  117. package/skills/melchizedek-onboard-local/SKILL.md +41 -0
  118. package/skills/melchizedek-onboard-serve/SKILL.md +43 -0
package/ONBOARDING.md ADDED
@@ -0,0 +1,339 @@
1
+ <!-- Generated by lib/onboarding.ts: `npm run setup -- --markdown > ONBOARDING.md`. Do not edit by hand; tests/onboarding.test.ts holds this file equal to the generator. -->
2
+
3
+ # Onboarding: start from what you have
4
+
5
+ Start with `npx melchizedek-setup` (in a clone, `npm run setup`). It opens a menu of the levels below and prints the guide for the one you pick; `--auto` reads your environment, names only, and prints the guide for the highest level it detects. Every guide lists variable names and shapes, never values: you type the values into `.env` yourself.
6
+
7
+ In a clone, the commands are spelled as npm scripts (`npm run doctor`, `npm run chat:syndicate -- --syndicate <name>`); the menu prints that spelling there.
8
+
9
+ | # | You have | Guide |
10
+ |---|---|---|
11
+ | 1 | Nothing yet: run open-weight models locally (Ollama, no key) | `--level local` |
12
+ | 2 | One provider's API key (Gemini, Anthropic, OpenAI, xAI or Moonshot) | `--level one-provider` |
13
+ | 3 | API keys for several providers | `--level several-providers` |
14
+ | 4 | One gateway key (Vercel AI Gateway or OpenRouter) | `--level gateway` |
15
+ | 5 | Cloud platform credentials (Vertex AI, Amazon Bedrock, Azure OpenAI) | `--level cloud-platform` |
16
+ | 6 | Serving over A2A where each caller brings its own model key (BYOK) | `--level byok` |
17
+ | 7 | Serving to other backends or users with their own tokens (A2A_AUTH) | `--level caller-tokens` |
18
+ | 8 | Tools that act for end users on third-party APIs (OAuth grants) | `--level oauth-grants` |
19
+ | 9 | A ChatGPT / Codex, Claude.ai or Gemini CLI sign-in (no API key) | `--level subscription-signin` |
20
+
21
+ ## 1. No keys: local models only
22
+
23
+ Every agent whose model id starts with `ollama/` runs on your machine through Ollama. No account, no key, and no data leaves the machine. Install Ollama from https://ollama.com and pull a model: `ollama pull qwen3:8b`.
24
+
25
+ **Set in `.env`** (names and shapes only; you type the values yourself):
26
+
27
+ | Variable | Shape | What it does |
28
+ |---|---|---|
29
+ | `OLLAMA_BASE_URL` | http://localhost:11434/v1 | optional: only for a non-default Ollama endpoint |
30
+
31
+ **Confirm:** `npx melchizedek-doctor`: the providers line shows `Ollama (local) local`, and the keyless files read `ready — local, no key`.
32
+
33
+ **Runs at this level:**
34
+
35
+ - keyless: conversational (template), assistant (example), council (example), tutor (example)
36
+
37
+ **First commands:**
38
+
39
+ ```bash
40
+ npx melchizedek-init --template conversational
41
+ npx melchizedek-chat --syndicate conversational
42
+ ```
43
+
44
+ **Notes:**
45
+
46
+ - Server-side search tools (web_search, google_search, x_search) are not available on Ollama; the doctor lists what each agent drops.
47
+ - Ollama serves a 4,096-token context by default; start it with `OLLAMA_CONTEXT_LENGTH=16384 ollama serve` before summarizing web pages.
48
+
49
+ **Onboarding skill:** `melchizedek-onboard-local` (`npx melchizedek-setup --level local` prints this guide)
50
+
51
+ ## 2. One provider's API key
52
+
53
+ The model id's prefix picks the provider, and that provider's key funds it. One key runs every file whose agents all use that provider. A Gemini key runs the most shipped files and also powers long-term memory's embeddings.
54
+
55
+ **Set in `.env`** (names and shapes only; you type the values yourself):
56
+
57
+ | Variable | Shape | What it does |
58
+ |---|---|---|
59
+ | `GOOGLE_GENAI_API_KEY` | an API key from https://aistudio.google.com | Google Gemini: model ids gemini-* (and any id without another prefix); also the default embedder for long-term memory (GEMINI_API_KEY is accepted too) |
60
+ | `ANTHROPIC_API_KEY` | an API key from https://console.anthropic.com | Anthropic Claude: model ids claude-* |
61
+ | `OPENAI_API_KEY` | an API key from https://platform.openai.com/api-keys | OpenAI GPT: model ids gpt-*, o<digit>* |
62
+ | `XAI_API_KEY` | an API key from https://console.x.ai | xAI Grok: model ids grok-* |
63
+ | `MOONSHOT_API_KEY` | an API key from https://platform.moonshot.ai | Moonshot Kimi: model ids kimi-* |
64
+
65
+ **Confirm:** `npx melchizedek-doctor`: the providers line shows a ✓ beside your provider, and the files of that tier read `ready`.
66
+
67
+ **Runs at this level:**
68
+
69
+ - GOOGLE_GENAI_API_KEY: account_memory (template), case_desk (template), draft_review (template), intake_extractor (template), research_brief (template), research_desk (template), review_panel (template), support_triage (template), systems_operator (template), ares (example), augustin (example), cartographers (example), critic (example), delegation (example), harness (example), hierarchical (example), image_production (example), librarian (example), patient_advocate (example), pipeline (example), research (example), scribe (example), scriptorium (example), style_council (example), syndicate (example), weather (example)
70
+ - ANTHROPIC_API_KEY: claude (example), structured_critic (example)
71
+ - OPENAI_API_KEY: no shipped file yet (change a `model:` line to use one)
72
+ - XAI_API_KEY: no shipped file yet (change a `model:` line to use one)
73
+ - MOONSHOT_API_KEY: no shipped file yet (change a `model:` line to use one)
74
+ - with no key at all: conversational (template), assistant (example), council (example), tutor (example)
75
+
76
+ **First commands:**
77
+
78
+ ```bash
79
+ npx melchizedek-init --template research_brief
80
+ npx melchizedek-chat --syndicate research_brief
81
+ ```
82
+
83
+ **Notes:**
84
+
85
+ - Set only the one variable you have; leave the others blank. The doctor names, per file, the variable that would unblock it.
86
+ - To run a shipped file on your provider, change its `model:` lines (for example `gemini-3.8-flash` to `claude-sonnet-4-6`); `doctor` then shows it ready.
87
+
88
+ **Onboarding skill:** `melchizedek-onboard-keys` (`npx melchizedek-setup --level one-provider` prints this guide)
89
+
90
+ ## 3. Several providers
91
+
92
+ Each key funds its own provider, and a syndicate may mix them: one agent on Claude, another on Gemini, a third local. A direct key always serves its provider at full fidelity (native search included).
93
+
94
+ **Set in `.env`** (names and shapes only; you type the values yourself):
95
+
96
+ | Variable | Shape | What it does |
97
+ |---|---|---|
98
+ | `GOOGLE_GENAI_API_KEY` | an API key from https://aistudio.google.com | Google Gemini: model ids gemini-* (and any id without another prefix); also the default embedder for long-term memory (GEMINI_API_KEY is accepted too) |
99
+ | `ANTHROPIC_API_KEY` | an API key from https://console.anthropic.com | Anthropic Claude: model ids claude-* |
100
+ | `OPENAI_API_KEY` | an API key from https://platform.openai.com/api-keys | OpenAI GPT: model ids gpt-*, o<digit>* |
101
+ | `XAI_API_KEY` | an API key from https://console.x.ai | xAI Grok: model ids grok-* |
102
+ | `MOONSHOT_API_KEY` | an API key from https://platform.moonshot.ai | Moonshot Kimi: model ids kimi-* |
103
+
104
+ **Confirm:** `npx melchizedek-doctor`: a ✓ beside each provider you set; `multi-provider` files read `ready` once every provider they use has its key.
105
+
106
+ **Runs at this level:**
107
+
108
+ - multi-provider: model_zoo (example)
109
+ - plus every single-provider file whose key you set (see level 2)
110
+
111
+ **First commands:**
112
+
113
+ ```bash
114
+ npx melchizedek-init --template model_zoo
115
+ npx melchizedek-chat --syndicate model_zoo
116
+ ```
117
+
118
+ **Notes:**
119
+
120
+ - A provider you have no key for can still be served by a gateway (level 4); a direct key set beside it wins for its own provider.
121
+
122
+ **Onboarding skill:** `melchizedek-onboard-keys` (`npx melchizedek-setup --level several-providers` prints this guide)
123
+
124
+ ## 4. A gateway key
125
+
126
+ One key serves every cloud model id whose direct key is absent, through the gateway's OpenAI-compatible endpoint. It is a fallback, never a preempt: a direct key always wins for its provider. Ollama never goes through it.
127
+
128
+ **Set in `.env`** (names and shapes only; you type the values yourself):
129
+
130
+ | Variable | Shape | What it does |
131
+ |---|---|---|
132
+ | `MODEL_GATEWAY` | vercel | openrouter | which gateway |
133
+ | `MODEL_GATEWAY_API_KEY` | the gateway key (https://vercel.com/ai-gateway or https://openrouter.ai/keys) | funds every id with no direct key |
134
+ | `MODEL_GATEWAY_BASE_URL` | https URL | optional: a self-hosted proxy speaking the same dialect (LiteLLM) |
135
+ | `MODEL_GATEWAY_MODEL_MAP` | yaml-id=gateway-id,yaml-id=gateway-id | optional: fix an id the default mapping gets wrong |
136
+
137
+ **Confirm:** `npx melchizedek-doctor`: a `gateway` line with no ✗, and providers without a direct key marked `◇ via gateway`.
138
+
139
+ **Runs at this level:**
140
+
141
+ - every cloud file: account_memory (template), case_desk (template), draft_review (template), intake_extractor (template), research_brief (template), research_desk (template), review_panel (template), support_triage (template), systems_operator (template), ares (example), augustin (example), cartographers (example), critic (example), delegation (example), harness (example), hierarchical (example), image_production (example), librarian (example), patient_advocate (example), pipeline (example), research (example), scribe (example), scriptorium (example), style_council (example), syndicate (example), weather (example), claude (example), structured_critic (example), model_zoo (example)
142
+
143
+ **First commands:**
144
+
145
+ ```bash
146
+ npx melchizedek-init --template research_brief
147
+ npx melchizedek-chat --syndicate research_brief
148
+ ```
149
+
150
+ **Notes:**
151
+
152
+ - Native search is lost on the gateway path (Gemini grounding, Anthropic and OpenAI web_search, xAI x_search); the doctor marks each dropped tool.
153
+ - Long-term memory embeds through Gemini by default, which the gateway does not serve: set GOOGLE_GENAI_API_KEY, or MEMORY_EMBEDDING_PROVIDER=openai or ollama.
154
+
155
+ **Onboarding skill:** `melchizedek-onboard-keys` (`npx melchizedek-setup --level gateway` prints this guide)
156
+
157
+ ## 5. Cloud platform credentials
158
+
159
+ The model id still picks the provider; these variables pick the cloud it is reached through, authenticated by that cloud's own credential chain instead of a vendor API key. Gemini and Claude on Vertex AI use Google Application Default Credentials (`gcloud auth application-default login`, or a service account); Claude on Bedrock uses the AWS credential chain; GPT on Azure uses an Azure key or Entra ID.
160
+
161
+ **Set in `.env`** (names and shapes only; you type the values yourself):
162
+
163
+ | Variable | Shape | What it does |
164
+ |---|---|---|
165
+ | `GEMINI_PLATFORM` | vertex | Gemini on Vertex AI (ADC) |
166
+ | `GOOGLE_CLOUD_PROJECT` | a Google Cloud project id | Vertex AI project |
167
+ | `GOOGLE_CLOUD_LOCATION` | a region, or global | Vertex AI location |
168
+ | `ANTHROPIC_PLATFORM` | bedrock | vertex | Claude on Bedrock (`npm install @anthropic-ai/bedrock-sdk`) or Vertex AI (`npm install @anthropic-ai/vertex-sdk`) |
169
+ | `AWS_REGION` | an AWS region, e.g. us-east-1 | Bedrock region; credentials come from the AWS chain (profile, role, SSO) |
170
+ | `ANTHROPIC_VERTEX_PROJECT_ID` | a Google Cloud project id | Claude on Vertex AI (falls back to GOOGLE_CLOUD_PROJECT) |
171
+ | `CLOUD_ML_REGION` | a region | Claude on Vertex AI (falls back to GOOGLE_CLOUD_LOCATION) |
172
+ | `OPENAI_PLATFORM` | azure | GPT on Azure OpenAI |
173
+ | `AZURE_OPENAI_ENDPOINT` | https://<resource>.openai.azure.com | the Azure OpenAI resource |
174
+ | `AZURE_OPENAI_API_KEY` | an Azure OpenAI key | optional: without it, Entra ID (`npm install @azure/identity`) |
175
+ | `ANTHROPIC_MODEL_MAP` | JSON: {"yaml-id":"platform-id"} | optional: Bedrock or Vertex model ids (OPENAI_MODEL_MAP for Azure deployments, GEMINI_MODEL_MAP likewise) |
176
+
177
+ **Confirm:** `npx melchizedek-doctor`: one `endpoint` line per provider on a cloud platform, with no ✗; the credential chain itself is not exercised by the doctor.
178
+
179
+ **Runs at this level:**
180
+
181
+ - Gemini on Vertex AI: account_memory (template), case_desk (template), draft_review (template), intake_extractor (template), research_brief (template), research_desk (template), review_panel (template), support_triage (template), systems_operator (template), ares (example), augustin (example), cartographers (example), critic (example), delegation (example), harness (example), hierarchical (example), image_production (example), librarian (example), patient_advocate (example), pipeline (example), research (example), scribe (example), scriptorium (example), style_council (example), syndicate (example), weather (example)
182
+ - Claude on Bedrock or Vertex AI: claude (example), structured_critic (example)
183
+ - GPT on Azure OpenAI: no shipped file yet (change a `model:` line to use one)
184
+
185
+ **First commands:**
186
+
187
+ ```bash
188
+ npx melchizedek-init --template research_brief
189
+ npx melchizedek-chat --syndicate research_brief
190
+ ```
191
+
192
+ **Notes:**
193
+
194
+ - The Vertex AI, Bedrock and Azure paths are tested against mocks and have not been run against the live clouds from this repository; the doctor says so.
195
+ - 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.
196
+
197
+ **Onboarding skill:** `melchizedek-onboard-cloud` (`npx melchizedek-setup --level cloud-platform` prints this guide)
198
+
199
+ ## 6. Per-caller keys when serving over A2A (BYOK)
200
+
201
+ The A2A server lets each caller fund its own inference: the caller sends its key in `X-API-Key` and the provider in `X-Provider`, and agents on that provider run on that key for that request. Agents on other providers, tools and memory extraction still run on the server's keys.
202
+
203
+ **Set in `.env`** (names and shapes only; you type the values yourself):
204
+
205
+ | Variable | Shape | What it does |
206
+ |---|---|---|
207
+ | `A2A_KEY_MODE` | byok | callers' X-API-Key funds X-Provider (default: server) |
208
+ | `A2A_SERVER_SECRET` | 64 hex characters (`openssl rand -hex 32`) | the bearer secret callers present (or caller tokens: level 7) |
209
+
210
+ **Confirm:** `npx melchizedek-doctor`: a `serving` line reading `A2A_KEY_MODE=byok` with no ✗.
211
+
212
+ **Runs at this level:**
213
+
214
+ - any file; start from a template: account_memory, case_desk, conversational, draft_review, intake_extractor, research_brief, research_desk, review_panel, support_triage, systems_operator
215
+
216
+ **First commands:**
217
+
218
+ ```bash
219
+ npx melchizedek-init --template conversational
220
+ npx melchizedek-serve conversational.yaml
221
+ ```
222
+
223
+ **Notes:**
224
+
225
+ - Under A2A_AUTH=secret, 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.
226
+ - Without A2A_SERVER_SECRET or caller tokens the server binds 127.0.0.1 only; set one before anyone else calls it.
227
+
228
+ **Onboarding skill:** `melchizedek-onboard-serve` (`npx melchizedek-setup --level byok` prints this guide)
229
+
230
+ ## 7. Serving with caller tokens (A2A_AUTH)
231
+
232
+ A2A_AUTH decides who a caller is, and so whose data a request touches. `callers` gives each calling backend its own bearer token (the config holds only its SHA-256); `jwt` accepts your identity provider's tokens; `header` trusts a user header set by an authenticating gateway that alone holds the secret; `secret` (the default) is one shared bearer secret.
233
+
234
+ **Set in `.env`** (names and shapes only; you type the values yourself):
235
+
236
+ | Variable | Shape | What it does |
237
+ |---|---|---|
238
+ | `A2A_AUTH` | callers | jwt | header | secret | the identity mode (required with PUBLIC_URL) |
239
+ | `A2A_CALLERS` | name:sha256[:scope];name:sha256[:scope] | callers: mint each with `melchizedek-serve --new-caller <name>` |
240
+ | `A2A_JWT_ISSUER` | https://your-idp.example/ | jwt: required iss |
241
+ | `A2A_JWT_AUDIENCE` | an audience string | jwt: required aud |
242
+ | `A2A_JWT_JWKS_URL` | https URL of the JWKS | jwt: RS256/ES256 keys (or A2A_JWT_SECRET, HS256, 32+ characters) |
243
+ | `A2A_TRUSTED_USER_HEADER` | a header name, e.g. X-Authenticated-User | header: set by your gateway |
244
+ | `A2A_SERVER_SECRET` | 64 hex characters (`openssl rand -hex 32`) | secret and header modes |
245
+ | `PUBLIC_URL` | https://agents.example.com | only on a public deployment; it then requires the three below |
246
+ | `A2A_SERVED_AGENTS` | comma list of agent ids, or * | which agents the server answers (required with PUBLIC_URL) |
247
+ | `A2A_TRUST_PROXY` | 1 behind one load balancer, or false | required with PUBLIC_URL |
248
+
249
+ **Confirm:** `npx melchizedek-doctor`: a `serving` line naming your A2A_AUTH mode with no ✗.
250
+
251
+ **Runs at this level:**
252
+
253
+ - any file; start from a template: account_memory, case_desk, conversational, draft_review, intake_extractor, research_brief, research_desk, review_panel, support_triage, systems_operator
254
+
255
+ **First commands:**
256
+
257
+ ```bash
258
+ npx melchizedek-init --template support_triage
259
+ npx melchizedek-serve --new-caller my-backend --token-file "$HOME/my-backend.token"
260
+ npx melchizedek-serve support_triage.yaml
261
+ ```
262
+
263
+ **Notes:**
264
+
265
+ - `--new-caller --token-file` writes the token to a new mode-600 file outside the project and prints only the `A2A_CALLERS` entry (a hash); move the token into the calling backend's secret store and delete the file. Without `--token-file` the token is printed once, so do not run it where a transcript is kept.
266
+ - Prefer callers or jwt on a public URL: under `secret`, any holder of the secret can act as any user by naming them in X-User-Id.
267
+
268
+ **Onboarding skill:** `melchizedek-onboard-serve` (`npx melchizedek-setup --level caller-tokens` prints this guide)
269
+
270
+ ## 8. OAuth tool grants for end users
271
+
272
+ A tool declared with `auth: { oauth2 }` (or an MCP server with `mcp_auth`) sends a third-party token. An authorization_code grant pauses the turn until the user consents; the token is sealed per user with the credential key and only sent to hosts the operator binds. A client_credentials grant uses the server's own client.
273
+
274
+ **Set in `.env`** (names and shapes only; you type the values yourself):
275
+
276
+ | Variable | Shape | What it does |
277
+ |---|---|---|
278
+ | `MELCHIZEDEK_CREDENTIAL_KEY` | 32 random bytes, base64 or 64 hex (`openssl rand -base64 32`) | seals each user's tokens; keep it out of the database and its backups |
279
+ | `OAUTH_REDIRECT_URI` | https://agents.example.com/oauth/callback (no query) | the consent callback, registered at every provider; needs the key |
280
+ | `MELCHIZEDEK_OAUTH_HOSTS` | provider=host,host;provider=host | the hosts each provider's tokens may go to; unset, authorization_code grants are refused |
281
+ | `OAUTH_CALLBACK_IDENTITY` | required | state | required (default) needs A2A_AUTH=header behind a gateway |
282
+ | `DATABASE_URL` | postgres://… | durable sealed store; without it, grants live in process memory |
283
+
284
+ **Confirm:** `npx melchizedek-doctor`: an `oauth` line with no ✗, and each `⚿` grant line naming no unset variable.
285
+
286
+ **Runs at this level:**
287
+
288
+ - declares a grant: no shipped file declares one active
289
+ - carries a commented grant to uncomment: systems_operator (template)
290
+
291
+ **First commands:**
292
+
293
+ ```bash
294
+ npx melchizedek-init --template systems_operator
295
+ # uncomment its mcp_auth block, then:
296
+ npx melchizedek-doctor # names the client id and secret variables the grant reads
297
+ npx melchizedek-serve systems_operator.yaml
298
+ ```
299
+
300
+ **Notes:**
301
+
302
+ - Each grant's client id and secret are read from variables the YAML names (client_id_env, client_secret_env); the framework's own settings are refused there.
303
+ - This level sits on top of a serving level: set A2A_AUTH first (level 7).
304
+
305
+ **Onboarding skill:** `melchizedek-onboard-serve` (`npx melchizedek-setup --level oauth-grants` prints this guide)
306
+
307
+ ## 9. Subscription sign-ins (ChatGPT / Codex, Claude.ai, Gemini CLI)
308
+
309
+ Not supported, on purpose. A consumer subscription sign-in authorizes that vendor's own apps. The engine does not read, reuse or relay those tokens: Anthropic and Google say third-party apps may not use them, and OpenAI's plan-usage sign-in is a preview for approved or locally hosted apps that this engine has not integrated. Use the same vendor's sanctioned route instead.
310
+
311
+ **Use instead** (names and shapes only):
312
+
313
+ | Variable | Shape | What it does |
314
+ |---|---|---|
315
+ | `OPENAI_API_KEY` | an API key from https://platform.openai.com/api-keys | instead of a ChatGPT / Codex sign-in (or Azure OpenAI: level 5) |
316
+ | `ANTHROPIC_API_KEY` | an API key from https://console.anthropic.com | instead of a Claude.ai sign-in (or Bedrock / Vertex AI: level 5) |
317
+ | `GOOGLE_GENAI_API_KEY` | an API key from https://aistudio.google.com (free tier) | instead of a Gemini CLI sign-in (or Vertex AI: level 5) |
318
+
319
+ **Confirm:** `npx melchizedek-doctor`: the provider you chose shows a ✓; nothing reads a subscription sign-in.
320
+
321
+ **Runs at this level:**
322
+
323
+ - as level 2 (one key) or level 5 (cloud platform)
324
+
325
+ **First commands:**
326
+
327
+ ```bash
328
+ npx melchizedek-init --template research_brief
329
+ npx melchizedek-chat --syndicate research_brief
330
+ ```
331
+
332
+ **Notes:**
333
+
334
+ - Anthropic: Claude.ai (Pro/Max) OAuth is for Claude Code and its own apps; third-party developers may not offer Claude.ai login or route requests through those credentials. Use an API key, Bedrock or Vertex AI.
335
+ - Google: reaching Gemini CLI's services with its sign-in from third-party software is against Gemini CLI's terms. Use an AI Studio key or Vertex AI.
336
+ - OpenAI: an API key or Azure OpenAI. OpenAI's Sign in with ChatGPT plan-usage flow is a documented preview for open-source, locally hosted apps; the engine does not implement it, and reusing the Codex CLI's own token is not that flow.
337
+ - A coding agent signed in with a subscription (Claude Code, Codex, Gemini CLI) can still drive this repository: the sign-in pays for the coding agent, and the engine runs on the keys above.
338
+
339
+ **Onboarding skill:** `melchizedek-onboard-keys` (`npx melchizedek-setup --level subscription-signin` prints this guide)
package/QUICKSTART.md CHANGED
@@ -3,6 +3,16 @@
3
3
  From zero to a running syndicate in five minutes; to persistent memory in
4
4
  fifteen. The full reference is [`DOCUMENTATION.md`](./DOCUMENTATION.md).
5
5
 
6
+ **Start with `npx melchizedek-setup`** (in a clone: `npm run setup`). It
7
+ asks what you have (no key, one or several provider keys, a gateway key,
8
+ Vertex AI / Bedrock / Azure access, a server to put in front of others, or
9
+ a ChatGPT, Claude or Gemini sign-in) and prints the startup guide for that
10
+ level: the variables to set (names only; you type the values into `.env`),
11
+ the doctor check, the shipped syndicates that run, and the first command.
12
+ `npm run setup -- --auto` detects your level without printing any value.
13
+ The same guides are in [`ONBOARDING.md`](./ONBOARDING.md); the steps below
14
+ are the two most common paths spelled out.
15
+
6
16
  ## 1. Prerequisites
7
17
 
8
18
  - **Node.js 22+** (the CLI uses `--experimental-strip-types` to run
@@ -182,6 +192,7 @@ own repo, the same engine is a typed dependency:
182
192
 
183
193
  ```bash
184
194
  npm install melchizedek-agents
195
+ npx melchizedek-setup # what you have → the startup guide for it
185
196
  npx melchizedek-init # config/agents/conversational.yaml + .env; --list for others
186
197
  npx melchizedek-doctor # which keys it needs, and whether it is ready
187
198
  ```
@@ -229,11 +240,13 @@ console.log(result.text);
229
240
  section of [`CHANGELOG.md`](./CHANGELOG.md).
230
241
  `npx melchizedek-doctor` prints which runtime is in use.
231
242
  - **Your coding agent can learn all of this.** The package ships a
232
- six-skill suite (`skills/`, the open SKILL.md standard) covering the
233
- catalog, authoring, serving, memory, models, and the Scribe:
243
+ eleven-skill suite (`skills/`, the open SKILL.md standard) covering
244
+ onboarding (start with `melchizedek-onboard`), the catalog, authoring,
245
+ serving, memory, models, and the Scribe:
234
246
 
235
247
  ```bash
236
248
  npx melchizedek-skills install # → .claude/skills + .agents/skills here
249
+ npx melchizedek-skills install --agents-md # … and point AGENTS.md at them
237
250
  npx melchizedek-skills install --for all --global
238
251
  ```
239
252
 
package/README.md CHANGED
@@ -17,12 +17,14 @@ Gemini, Claude, GPT, Grok, and Kimi each run on the engine's own adapter for the
17
17
  - **Native tools** — Web search, image generation, and a blind image-inventory tool that accepts only a file path, so the expected result can never reach the observer.
18
18
  - **Agent-to-Agent (A2A) serving** — Serve any syndicate over HTTP as a JSON-RPC endpoint with bearer auth and rate limiting.
19
19
  - **Knowledge bundle** — `wiki/` documents the framework as an [Open Knowledge Format](https://github.com/GoogleCloudPlatform/knowledge-catalog) bundle; `lib/wiki/` builds, lints, and searches any such bundle (`npm run mcp:wiki` serves the tools to MCP clients).
20
- - **Coding agent skills** — Six skills in the open `SKILL.md` standard for Claude Code, Codex, Cursor, OpenCode, and Gemini CLI.
20
+ - **Coding agent skills** — Eleven skills in the open `SKILL.md` standard for Claude Code, Codex, Cursor, OpenCode, and Gemini CLI, five of them for onboarding a user from whatever credentials they have.
21
21
 
22
22
  ---
23
23
 
24
24
  ## Quick Start
25
25
 
26
+ Start with `npx melchizedek-setup` (in a clone, `npm run setup`). Tell it what you have (no key, one or several provider keys, a gateway key, Vertex AI / Bedrock / Azure access, a server to put in front of other people, or a ChatGPT, Claude or Gemini sign-in) and it prints the startup guide for that level: which variables to set, the doctor check, which shipped syndicates run, and the first command. `npx melchizedek-setup --auto` detects the level from your environment without printing any value. The guides are also in [ONBOARDING.md](./ONBOARDING.md).
27
+
26
28
  ### 1. Local-only (no API keys)
27
29
 
28
30
  Prerequisite: install [Ollama](https://ollama.com).
@@ -153,10 +155,11 @@ A Gemini id resolves to the engine's `GeminiAdapter` here, on `@google/genai`.
153
155
 
154
156
  ### CLI & Server Utilities
155
157
 
158
+ - `npx melchizedek-setup`: The onboarding menu: pick what you have, get the startup guide for it (`--auto` detects it).
156
159
  - `npx melchizedek-chat --syndicate <name>`: Interactive CLI REPL for any syndicate.
157
160
  - `npx melchizedek-serve`: Serve your `./config/agents/` over HTTP via JSON-RPC.
158
161
  - `npx melchizedek-doctor`: Report which syndicates your keys unlock, without sending a request.
159
- - `npx melchizedek-skills install`: Install the agent skills into `.claude/skills/` and `.agents/skills/`.
162
+ - `npx melchizedek-skills install`: Install the agent skills into `.claude/skills/` and `.agents/skills/` (`--agents-md` also points `AGENTS.md` at them).
160
163
 
161
164
  ---
162
165
 
@@ -34,7 +34,7 @@ orchestrator:
34
34
  You are the Moderator of the Council, a small deliberative body that stress-tests claims and plans.
35
35
  The user brings a claim, a plan, or a decision they are weighing. You weigh what your two subagents report; you do not research the claim, and you never argue a side yourself.
36
36
  TASK: hand back one verdict on the user's claim, in the three-part shape below, built only from the two reports.
37
- You MUST consult BOTH of your subagents before answering: first the 'Advocate' (the strongest honest case FOR), then the 'Skeptic' (the strongest honest case AGAINST). Pass each one the user's claim verbatim.
37
+ You MUST consult BOTH of your subagents before answering, in a single step: call the 'Advocate' (the strongest honest case FOR) and the 'Skeptic' (the strongest honest case AGAINST) together, both function calls in the same response, so they work at once. Pass each one the user's full claim verbatim, never a summary or a part of it.
38
38
  Before you write the verdict, decide which single consideration in the two reports weighs most. THE VERDICT names it; the rest of your weighing stays out of the reply.
39
39
  Once both reports are in, weigh them and deliver a verdict in exactly this shape:
40
40
  - THE CASE FOR: the Advocate's two strongest points, compressed into at most two sentences.
@@ -2,14 +2,14 @@
2
2
  syndicate_name: "Critic Review Workflow"
3
3
 
4
4
  # WHY this structure: an agent with an outputSchema answers in that schema and
5
- # nothing else. On an orchestrator that delegates, the engine (on most
6
- # models) adds a set_model_response tool beside the subagent tools and the
7
- # turn ends on the JSON it receives (lib/runtime/native/request.ts), so the
8
- # user would get the review object instead of the answer; under Google ADK,
9
- # before 1.0.0, an orchestrator holding both deadlocked. Solution: the
10
- # orchestrator is a plain sequencer that routes Drafter → Critic, and the
11
- # CriticAgent (a leaf with no tools and no subagents) owns the outputSchema
12
- # for structured JSON production.
5
+ # nothing else. An orchestrator that delegates may hold one (ADR 0109): it
6
+ # delegates first, then ends its turn on the JSON, so the user receives the
7
+ # review object itself (structured_critic.yaml is that shape). Here the user
8
+ # should receive the polished answer, not the grading, so the orchestrator
9
+ # is a plain sequencer that routes Drafter → Critic, and the CriticAgent (a
10
+ # leaf with no tools and no subagents) owns the outputSchema the
11
+ # orchestrator's gate reads. The leaf is a choice for this answer, not a
12
+ # rule of the engine.
13
13
  #
14
14
  # WHY multi-turn internal looping:
15
15
  # The engine's agent loop keeps executing within a single user turn as long
@@ -16,9 +16,10 @@ memory_system: "session-only"
16
16
  # path — the spec physically cannot reach the inventory, so expectation bias
17
17
  # is blocked by the tool signature, not by good intentions. SpecAuditor is a
18
18
  # text-only leaf that receives spec + inventory but never the image, and
19
- # holds the outputSchema (the same rule as critic.yaml: the schema-holder
20
- # is a leaf that delegates nothing). Perception, judgment, and decision are three
21
- # different minds.
19
+ # holds the outputSchema, so its verdict is JSON while ImageDesigner keeps
20
+ # answering the user in prose (the same choice as critic.yaml; an
21
+ # orchestrator may hold a schema itself, ADR 0109, but then its own reply
22
+ # is the JSON). Perception, judgment, and decision are three different minds.
22
23
  #
23
24
  # WHY the instruction maps payload fields to tool parameters by name
24
25
  # (step 6): the payload holds `meta.artist_style`, the tool takes `style`.
@@ -156,7 +156,7 @@
156
156
  }
157
157
  },
158
158
  "additionalProperties": {},
159
- "description": "Deprecated v1 spelling (ADR 0115): write `sampling` (temperature, top_p, max_output_tokens, stop), `output.mime` (responseMimeType) and `reasoning` (thinkingConfig, reasoningEffort) instead; npx melchizedek-codemod rewrites a file. Still read: the Gemini GenerateContentConfig shape the engine takes. Do not set tools here.",
159
+ "description": "Deprecated v1 spelling (ADR 0115): write `sampling` (temperature, top_p, max_output_tokens, stop), `output.mime` (responseMimeType), `reasoning` (thinkingConfig, reasoningEffort) and `tool_choice` (toolConfig.functionCallingConfig) instead; npx melchizedek-codemod rewrites a file. Still read: the Gemini GenerateContentConfig shape the engine takes. Do not set tools here.",
160
160
  "deprecated": true
161
161
  },
162
162
  "reasoning": {
@@ -167,7 +167,9 @@
167
167
  "none",
168
168
  "low",
169
169
  "medium",
170
- "high"
170
+ "high",
171
+ "xhigh",
172
+ "max"
171
173
  ]
172
174
  },
173
175
  {
@@ -186,7 +188,7 @@
186
188
  "additionalProperties": false
187
189
  }
188
190
  ],
189
- "description": "How hard this agent reasons, on any provider: none | low | medium | high, or { budget_tokens: <int> }. Replaces generateContentConfig.thinkingConfig and reasoningEffort (ADR 0047)."
191
+ "description": "How hard this agent reasons, on any provider: none | low | medium | high | xhigh | max, or { budget_tokens: <int> }. xhigh and max reach the models that take them; elsewhere they go as the model's highest setting (ADR 0117). Replaces generateContentConfig.thinkingConfig and reasoningEffort (ADR 0047)."
190
192
  },
191
193
  "sampling": {
192
194
  "type": "object",
@@ -242,6 +244,33 @@
242
244
  "description": "What this agent's final reply is (ADR 0115). Replaces outputSchema and generateContentConfig.responseMimeType; cannot be combined with them.",
243
245
  "minProperties": 1
244
246
  },
247
+ "tool_choice": {
248
+ "anyOf": [
249
+ {
250
+ "type": "string",
251
+ "enum": [
252
+ "auto",
253
+ "none",
254
+ "required"
255
+ ]
256
+ },
257
+ {
258
+ "type": "object",
259
+ "properties": {
260
+ "name": {
261
+ "type": "string",
262
+ "minLength": 1,
263
+ "description": "The one tool the model must call: a name from this agent's tools, subagents or MCP tools."
264
+ }
265
+ },
266
+ "required": [
267
+ "name"
268
+ ],
269
+ "additionalProperties": false
270
+ }
271
+ ],
272
+ "description": "Which tools the model may call, on any provider (ADR 0117): auto (the default), none, required (some tool), or { name: <tool> } (that tool). A provider that rejects forcing sends a weaker choice and marks the span llm.tool_choice.weakened. Replaces generateContentConfig.toolConfig.functionCallingConfig; cannot be combined with it."
273
+ },
245
274
  "model_overrides": {
246
275
  "type": "object",
247
276
  "properties": {
@@ -965,7 +994,7 @@
965
994
  }
966
995
  },
967
996
  "additionalProperties": {},
968
- "description": "Deprecated v1 spelling (ADR 0115): write `sampling` (temperature, top_p, max_output_tokens, stop), `output.mime` (responseMimeType) and `reasoning` (thinkingConfig, reasoningEffort) instead; npx melchizedek-codemod rewrites a file. Still read: the Gemini GenerateContentConfig shape the engine takes. Do not set tools here.",
997
+ "description": "Deprecated v1 spelling (ADR 0115): write `sampling` (temperature, top_p, max_output_tokens, stop), `output.mime` (responseMimeType), `reasoning` (thinkingConfig, reasoningEffort) and `tool_choice` (toolConfig.functionCallingConfig) instead; npx melchizedek-codemod rewrites a file. Still read: the Gemini GenerateContentConfig shape the engine takes. Do not set tools here.",
969
998
  "deprecated": true
970
999
  },
971
1000
  "reasoning": {
@@ -976,7 +1005,9 @@
976
1005
  "none",
977
1006
  "low",
978
1007
  "medium",
979
- "high"
1008
+ "high",
1009
+ "xhigh",
1010
+ "max"
980
1011
  ]
981
1012
  },
982
1013
  {
@@ -995,7 +1026,7 @@
995
1026
  "additionalProperties": false
996
1027
  }
997
1028
  ],
998
- "description": "How hard this agent reasons, on any provider: none | low | medium | high, or { budget_tokens: <int> }. Replaces generateContentConfig.thinkingConfig and reasoningEffort (ADR 0047)."
1029
+ "description": "How hard this agent reasons, on any provider: none | low | medium | high | xhigh | max, or { budget_tokens: <int> }. xhigh and max reach the models that take them; elsewhere they go as the model's highest setting (ADR 0117). Replaces generateContentConfig.thinkingConfig and reasoningEffort (ADR 0047)."
999
1030
  },
1000
1031
  "sampling": {
1001
1032
  "type": "object",
@@ -1051,6 +1082,33 @@
1051
1082
  "description": "What this agent's final reply is (ADR 0115). Replaces outputSchema and generateContentConfig.responseMimeType; cannot be combined with them.",
1052
1083
  "minProperties": 1
1053
1084
  },
1085
+ "tool_choice": {
1086
+ "anyOf": [
1087
+ {
1088
+ "type": "string",
1089
+ "enum": [
1090
+ "auto",
1091
+ "none",
1092
+ "required"
1093
+ ]
1094
+ },
1095
+ {
1096
+ "type": "object",
1097
+ "properties": {
1098
+ "name": {
1099
+ "type": "string",
1100
+ "minLength": 1,
1101
+ "description": "The one tool the model must call: a name from this agent's tools, subagents or MCP tools."
1102
+ }
1103
+ },
1104
+ "required": [
1105
+ "name"
1106
+ ],
1107
+ "additionalProperties": false
1108
+ }
1109
+ ],
1110
+ "description": "Which tools the model may call, on any provider (ADR 0117): auto (the default), none, required (some tool), or { name: <tool> } (that tool). A provider that rejects forcing sends a weaker choice and marks the span llm.tool_choice.weakened. Replaces generateContentConfig.toolConfig.functionCallingConfig; cannot be combined with it."
1111
+ },
1054
1112
  "model_overrides": {
1055
1113
  "type": "object",
1056
1114
  "properties": {
@@ -1613,7 +1671,7 @@
1613
1671
  "additionalProperties": false
1614
1672
  },
1615
1673
  "yaml_reference": {
1616
- "description": "A whole nested syndicate (filename under the agents dir) used as this subagent. An approval request or ask_user question raised inside it pauses the turn with the agent path (ADR 0110, ADR 0111): a delegate syndicate's gates anywhere, a dispatch syndicate's on its classifier (its routes never run nested), and a workflow's ask_user nodes and gates when it is delegated to as a subagent.",
1674
+ "description": "A whole nested syndicate (filename under the agents dir) used as this subagent. An approval request or ask_user question raised inside it pauses the turn with the agent path (ADR 0110, ADR 0111): a delegate syndicate's gates anywhere, a dispatch syndicate's on its routes, which it classifies and runs as at the top, its route's answer being its own (ADR 0120), and a workflow's ask_user nodes and gates, wherever each runs: delegated to as a subagent, as a dispatch route or as a workflow node (ADR 0119).",
1617
1675
  "type": "string",
1618
1676
  "minLength": 1
1619
1677
  },