melchizedek-agents 0.9.6 β†’ 0.16.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 (246) hide show
  1. package/.env.example +272 -0
  2. package/AGENT_SETUP.md +39 -23
  3. package/CHANGELOG.md +623 -0
  4. package/DOCUMENTATION.md +429 -109
  5. package/QUICKSTART.md +92 -18
  6. package/README.md +45 -5
  7. package/config/agents/README.md +46 -1
  8. package/config/agents/examples/ares.yaml +117 -40
  9. package/config/agents/examples/assistant.yaml +159 -0
  10. package/config/agents/examples/augustin.yaml +154 -51
  11. package/config/agents/examples/cartographers.yaml +91 -23
  12. package/config/agents/examples/claude.yaml +45 -6
  13. package/config/agents/examples/council.yaml +23 -8
  14. package/config/agents/examples/critic.yaml +57 -21
  15. package/config/agents/examples/delegation.yaml +76 -9
  16. package/config/agents/examples/hierarchical.yaml +55 -8
  17. package/config/agents/examples/image_production.yaml +54 -16
  18. package/config/agents/examples/librarian.yaml +70 -14
  19. package/config/agents/examples/model_zoo.yaml +105 -29
  20. package/config/agents/examples/patient_advocate.yaml +102 -34
  21. package/config/agents/examples/research.yaml +250 -0
  22. package/config/agents/examples/scribe.yaml +242 -0
  23. package/config/agents/examples/scriptorium.yaml +87 -24
  24. package/config/agents/examples/style_council.yaml +31 -9
  25. package/config/agents/examples/syndicate.yaml +29 -10
  26. package/config/agents/examples/tutor.yaml +10 -3
  27. package/config/agents/syndicateSchema.yaml +44 -9
  28. package/config/agents/templates/README.md +58 -0
  29. package/config/agents/templates/account_memory.yaml +153 -0
  30. package/config/agents/templates/case_desk.yaml +188 -0
  31. package/config/agents/templates/conversational.yaml +110 -0
  32. package/config/agents/templates/draft_review.yaml +130 -0
  33. package/config/agents/templates/intake_extractor.yaml +152 -0
  34. package/config/agents/templates/research_brief.yaml +169 -0
  35. package/config/agents/templates/research_desk.yaml +152 -0
  36. package/config/agents/templates/review_panel.yaml +188 -0
  37. package/config/agents/templates/support_triage.yaml +273 -0
  38. package/config/agents/templates/systems_operator.yaml +157 -0
  39. package/db/hardening.sql +202 -0
  40. package/db/memory_v2.sql +77 -0
  41. package/db/migrations/0001_base.sql +167 -0
  42. package/db/migrations/0002_erase_scope.sql +172 -0
  43. package/db/migrations/0003_postgres_storage.sql +58 -0
  44. package/db/migrations/0004_usage.sql +94 -0
  45. package/db/migrations/0005_agent_registry.sql +200 -0
  46. package/db/migrations/0006_task_leases.sql +25 -0
  47. package/db/migrations/0007_memory_commit.sql +134 -0
  48. package/db/migrations/0008_memory_retention.sql +37 -0
  49. package/db/migrations/0009_task_queue.sql +51 -0
  50. package/db/migrations/0010_erase_complete.sql +180 -0
  51. package/db/telemetry.sql +401 -0
  52. package/demo/README.md +77 -0
  53. package/demo/a2a_demo.mjs +95 -0
  54. package/dist/lib/a2a/app.d.ts +253 -0
  55. package/dist/lib/a2a/app.js +751 -0
  56. package/dist/lib/a2a/executor.d.ts +167 -0
  57. package/dist/lib/a2a/executor.js +548 -0
  58. package/dist/lib/a2a/identity.d.ts +122 -0
  59. package/dist/lib/a2a/identity.js +254 -0
  60. package/dist/lib/a2a/policy.d.ts +110 -0
  61. package/dist/lib/a2a/policy.js +178 -0
  62. package/dist/lib/a2a/redisLimits.d.ts +26 -0
  63. package/dist/lib/a2a/redisLimits.js +31 -0
  64. package/dist/lib/a2a/remoteAgent.d.ts +91 -0
  65. package/dist/lib/a2a/remoteAgent.js +268 -0
  66. package/dist/lib/a2a/turnLock.d.ts +28 -0
  67. package/dist/lib/a2a/turnLock.js +76 -0
  68. package/dist/lib/compile.d.ts +11 -1
  69. package/dist/lib/compile.js +109 -8
  70. package/dist/lib/config.d.ts +7 -7
  71. package/dist/lib/config.js +7 -7
  72. package/dist/lib/doctor.d.ts +145 -0
  73. package/dist/lib/doctor.js +517 -0
  74. package/dist/lib/grounding.d.ts +2 -2
  75. package/dist/lib/grounding.js +2 -2
  76. package/dist/lib/guards/index.d.ts +37 -0
  77. package/dist/lib/guards/index.js +66 -0
  78. package/dist/lib/guards/science.d.ts +117 -0
  79. package/dist/lib/guards/science.js +444 -0
  80. package/dist/lib/index.d.ts +37 -2
  81. package/dist/lib/index.js +35 -4
  82. package/dist/lib/loadEnv.d.ts +23 -11
  83. package/dist/lib/loadEnv.js +77 -29
  84. package/dist/lib/loadSyndicate.d.ts +97 -5
  85. package/dist/lib/loadSyndicate.js +176 -76
  86. package/dist/lib/memory/erase.d.ts +24 -0
  87. package/dist/lib/memory/erase.js +47 -0
  88. package/dist/lib/memory/namespace.d.ts +37 -0
  89. package/dist/lib/memory/namespace.js +74 -0
  90. package/dist/lib/memory/providers.d.ts +99 -0
  91. package/dist/lib/memory/providers.js +240 -0
  92. package/dist/lib/memory/store.d.ts +74 -0
  93. package/dist/lib/memory/store.js +108 -0
  94. package/dist/lib/memory/supabaseMemoryService.d.ts +69 -9
  95. package/dist/lib/memory/supabaseMemoryService.js +239 -125
  96. package/dist/lib/models/capabilities.d.ts +103 -0
  97. package/dist/lib/models/capabilities.js +291 -0
  98. package/dist/lib/models/claudeLlm.d.ts +10 -1
  99. package/dist/lib/models/claudeLlm.js +57 -27
  100. package/dist/lib/models/endpoints.d.ts +100 -0
  101. package/dist/lib/models/endpoints.js +282 -0
  102. package/dist/lib/models/gateway.d.ts +107 -0
  103. package/dist/lib/models/gateway.js +157 -0
  104. package/dist/lib/models/gatewayLlm.d.ts +57 -0
  105. package/dist/lib/models/gatewayLlm.js +105 -0
  106. package/dist/lib/models/gptLlm.d.ts +51 -2
  107. package/dist/lib/models/gptLlm.js +169 -26
  108. package/dist/lib/models/grokLlm.d.ts +19 -10
  109. package/dist/lib/models/grokLlm.js +29 -14
  110. package/dist/lib/models/ollamaLlm.d.ts +26 -0
  111. package/dist/lib/models/ollamaLlm.js +43 -1
  112. package/dist/lib/models/openAiCompatibleLlm.d.ts +67 -2
  113. package/dist/lib/models/openAiCompatibleLlm.js +200 -37
  114. package/dist/lib/models/providerMap.js +9 -2
  115. package/dist/lib/models/registry.d.ts +42 -5
  116. package/dist/lib/models/registry.js +140 -29
  117. package/dist/lib/models/retry.d.ts +146 -0
  118. package/dist/lib/models/retry.js +305 -0
  119. package/dist/lib/models/schemaNormalize.d.ts +20 -0
  120. package/dist/lib/models/schemaNormalize.js +43 -0
  121. package/dist/lib/net/addressGuard.d.ts +60 -0
  122. package/dist/lib/net/addressGuard.js +216 -0
  123. package/dist/lib/observability/embeddings.d.ts +11 -2
  124. package/dist/lib/observability/embeddings.js +18 -14
  125. package/dist/lib/observability/metrics.d.ts +36 -0
  126. package/dist/lib/observability/metrics.js +86 -0
  127. package/dist/lib/observability/redact.d.ts +29 -0
  128. package/dist/lib/observability/redact.js +102 -0
  129. package/dist/lib/observability/supabaseSpanExporter.d.ts +2 -0
  130. package/dist/lib/observability/supabaseSpanExporter.js +22 -6
  131. package/dist/lib/observability/tracer.d.ts +10 -0
  132. package/dist/lib/observability/tracer.js +70 -3
  133. package/dist/lib/persistence/supabaseProvider.d.ts +11 -0
  134. package/dist/lib/persistence/supabaseProvider.js +32 -6
  135. package/dist/lib/registry.d.ts +87 -0
  136. package/dist/lib/registry.js +146 -0
  137. package/dist/lib/runtime/approvals.d.ts +44 -0
  138. package/dist/lib/runtime/approvals.js +67 -0
  139. package/dist/lib/runtime/syndicateTurn.d.ts +233 -0
  140. package/dist/lib/runtime/syndicateTurn.js +597 -0
  141. package/dist/lib/runtime/turnControl.d.ts +90 -0
  142. package/dist/lib/runtime/turnControl.js +131 -0
  143. package/dist/lib/session/supabaseSessionService.js +1 -1
  144. package/dist/lib/session/transcript.d.ts +9 -1
  145. package/dist/lib/session/transcript.js +15 -7
  146. package/dist/lib/skills.d.ts +50 -0
  147. package/dist/lib/skills.js +138 -0
  148. package/dist/lib/storage/postgres/index.d.ts +98 -0
  149. package/dist/lib/storage/postgres/index.js +146 -0
  150. package/dist/lib/storage/postgres/memoryStore.d.ts +11 -0
  151. package/dist/lib/storage/postgres/memoryStore.js +82 -0
  152. package/dist/lib/storage/postgres/sessionService.d.ts +51 -0
  153. package/dist/lib/storage/postgres/sessionService.js +225 -0
  154. package/dist/lib/storage/postgres/taskQueue.d.ts +22 -0
  155. package/dist/lib/storage/postgres/taskQueue.js +101 -0
  156. package/dist/lib/storage/postgres/taskStore.d.ts +55 -0
  157. package/dist/lib/storage/postgres/taskStore.js +168 -0
  158. package/dist/lib/storage/schema.d.ts +27 -0
  159. package/dist/lib/storage/schema.js +50 -0
  160. package/dist/lib/storage/schemaVersion.d.ts +25 -0
  161. package/dist/lib/storage/schemaVersion.js +46 -0
  162. package/dist/lib/syndicateSchema.d.ts +275 -0
  163. package/dist/lib/syndicateSchema.js +534 -0
  164. package/dist/lib/toolRegistry.d.ts +15 -0
  165. package/dist/lib/toolRegistry.js +59 -10
  166. package/dist/lib/tools/collectionsSearchTool.js +1 -1
  167. package/dist/lib/tools/mcpServe.d.ts +45 -0
  168. package/dist/lib/tools/mcpServe.js +88 -0
  169. package/dist/lib/tools/mcpToolFactory.d.ts +2 -0
  170. package/dist/lib/tools/mcpToolFactory.js +41 -21
  171. package/dist/lib/tools/science/corrections.d.ts +42 -0
  172. package/dist/lib/tools/science/corrections.js +115 -0
  173. package/dist/lib/tools/science/europepmc.d.ts +51 -0
  174. package/dist/lib/tools/science/europepmc.js +127 -0
  175. package/dist/lib/tools/science/http.d.ts +31 -0
  176. package/dist/lib/tools/science/http.js +104 -0
  177. package/dist/lib/tools/science/openalex.d.ts +30 -0
  178. package/dist/lib/tools/science/openalex.js +81 -0
  179. package/dist/lib/tools/science/trials.d.ts +58 -0
  180. package/dist/lib/tools/science/trials.js +203 -0
  181. package/dist/lib/tools/science/types.d.ts +69 -0
  182. package/dist/lib/tools/science/types.js +48 -0
  183. package/dist/lib/tools/scienceTools.d.ts +100 -0
  184. package/dist/lib/tools/scienceTools.js +277 -0
  185. package/dist/lib/tools/taskTools.d.ts +204 -0
  186. package/dist/lib/tools/taskTools.js +374 -0
  187. package/dist/lib/tools/toolContract.d.ts +17 -4
  188. package/dist/lib/tools/toolContract.js +13 -5
  189. package/dist/lib/tools/webExtractTool.d.ts +13 -10
  190. package/dist/lib/tools/webExtractTool.js +23 -55
  191. package/dist/lib/tools/webSearchTool.d.ts +2 -1
  192. package/dist/lib/tools/webSearchTool.js +4 -3
  193. package/dist/lib/tools/wikiTools.d.ts +2 -2
  194. package/dist/lib/tools/wikiTools.js +12 -12
  195. package/dist/lib/tools/xApiSearchTool.d.ts +194 -0
  196. package/dist/lib/tools/xApiSearchTool.js +583 -0
  197. package/dist/lib/tools/xSearchTool.js +1 -1
  198. package/dist/lib/wiki/agentRun.js +1 -1
  199. package/dist/lib/wiki/builder.js +21 -6
  200. package/dist/lib/wiki/dive.js +2 -2
  201. package/dist/lib/wiki/entities.d.ts +2 -2
  202. package/dist/lib/wiki/entities.js +7 -7
  203. package/dist/lib/wiki/extract.js +5 -1
  204. package/dist/lib/wiki/fill.js +5 -5
  205. package/dist/lib/wiki/format.d.ts +7 -5
  206. package/dist/lib/wiki/format.js +2 -2
  207. package/dist/lib/wiki/graph.js +2 -2
  208. package/dist/lib/wiki/lint.js +2 -2
  209. package/dist/lib/wiki/markdown.d.ts +1 -1
  210. package/dist/lib/wiki/markdown.js +6 -1
  211. package/dist/lib/wiki/pipeline.js +2 -2
  212. package/dist/lib/wiki/vault.js +2 -2
  213. package/dist/scripts/a2a_server.d.ts +17 -11
  214. package/dist/scripts/a2a_server.js +405 -1028
  215. package/dist/scripts/assistant_worker.d.ts +33 -0
  216. package/dist/scripts/assistant_worker.js +193 -0
  217. package/dist/scripts/db.d.ts +26 -0
  218. package/dist/scripts/db.js +179 -0
  219. package/dist/scripts/doctor.d.ts +23 -0
  220. package/dist/scripts/doctor.js +90 -0
  221. package/dist/scripts/init.d.ts +43 -0
  222. package/dist/scripts/init.js +152 -0
  223. package/dist/scripts/registry.d.ts +25 -0
  224. package/dist/scripts/registry.js +182 -0
  225. package/dist/scripts/skills_install.d.ts +7 -0
  226. package/dist/scripts/skills_install.js +137 -0
  227. package/dist/scripts/syndicate_chat.js +159 -276
  228. package/package.json +90 -16
  229. package/skills/README.md +74 -0
  230. package/skills/briefs/README.md +16 -0
  231. package/skills/briefs/_shared.md +16 -0
  232. package/skills/briefs/melchizedek-author.md +60 -0
  233. package/skills/briefs/melchizedek-memory.md +47 -0
  234. package/skills/briefs/melchizedek-models.md +47 -0
  235. package/skills/briefs/melchizedek-scribe.md +37 -0
  236. package/skills/briefs/melchizedek-serve.md +56 -0
  237. package/skills/briefs/melchizedek.md +69 -0
  238. package/skills/briefs/skills-readme.md +33 -0
  239. package/skills/melchizedek/SKILL.md +159 -0
  240. package/skills/melchizedek-author/SKILL.md +99 -0
  241. package/skills/melchizedek-author/templates/minimal.yaml +60 -0
  242. package/skills/melchizedek-memory/SKILL.md +138 -0
  243. package/skills/melchizedek-models/SKILL.md +137 -0
  244. package/skills/melchizedek-scribe/SKILL.md +72 -0
  245. package/skills/melchizedek-scribe/templates/brief.md +27 -0
  246. package/skills/melchizedek-serve/SKILL.md +119 -0
package/.env.example ADDED
@@ -0,0 +1,272 @@
1
+ # ── Required for cloud models ─────────────────────────────────────────────────
2
+ # Google AI Studio API key β€” powers all Gemini model inference.
3
+ # Also required for the gemini-embedding-001 embedding model used by long-term memory.
4
+ # Get yours free at: https://aistudio.google.com
5
+ # NOT needed for all-local syndicates (tutor, council) β€” see the Ollama note below.
6
+ GOOGLE_GENAI_API_KEY=
7
+
8
+ # ── Optional: Ollama (open-weight local models) ───────────────────────────────
9
+ # NO KEY NEEDED. Syndicates whose every agent uses an ollama/* model id (e.g.
10
+ # ollama/qwen3:8b) run entirely on your machine via Ollama's OpenAI-compatible
11
+ # API β€” install from https://ollama.com and `ollama pull qwen3:8b`.
12
+ # Set this only to point at a non-default Ollama endpoint.
13
+ # OLLAMA_BASE_URL=http://localhost:11434/v1
14
+ # A local reasoning model that thinks without answering (OLLAMA_MAX_TOKENS /
15
+ # OLLAMA_EMPTY_RESPONSE) is retried once with thinking off; false disables it.
16
+ # OLLAMA_RETRY_WITHOUT_THINKING=true
17
+
18
+ # Where the task tools and the background worker (npm run assistant:worker)
19
+ # keep their task list and job queue. Default: outputs/tasks.json.
20
+ # MELCHIZEDEK_TASKS_FILE=outputs/tasks.json
21
+
22
+ # ── Optional: MCP (Model Context Protocol) ────────────────────────────────────
23
+ # ALLOW_PRIVATE_MCP: set to "true" to permit mcp_server_url values pointing at
24
+ # localhost / private / link-local hosts. Off by default as an SSRF guard;
25
+ # turn it on for local development β€” e.g. the librarian demo (npm run mcp:demo).
26
+ ALLOW_PRIVATE_MCP=false
27
+
28
+ # ── Optional: Anthropic / Claude ──────────────────────────────────────────────
29
+ # Required only when using claude-* model identifiers in syndicate YAML configs.
30
+ # Get your key at: https://console.anthropic.com
31
+ ANTHROPIC_API_KEY=
32
+
33
+ # ── Optional: OpenAI / GPT ────────────────────────────────────────────────────
34
+ # Required only when using gpt-* (or o-series) model identifiers in YAML.
35
+ # Get your key at: https://platform.openai.com/api-keys
36
+ OPENAI_API_KEY=
37
+
38
+ # ── Optional: cloud platforms and proxies (ADR 0023) ─────────────────────────
39
+ # The model id picks the provider; these pick how it is reached. Default:
40
+ # the vendor's public API with the key above. Tested against mocks only.
41
+ # GEMINI_PLATFORM=vertex # + GOOGLE_CLOUD_PROJECT, GOOGLE_CLOUD_LOCATION (ADC)
42
+ # ANTHROPIC_PLATFORM=bedrock # + AWS_REGION (AWS chain; npm install @anthropic-ai/bedrock-sdk)
43
+ # ANTHROPIC_PLATFORM=vertex # + ANTHROPIC_VERTEX_PROJECT_ID, CLOUD_ML_REGION (npm install @anthropic-ai/vertex-sdk)
44
+ # OPENAI_PLATFORM=azure # + AZURE_OPENAI_ENDPOINT, and AZURE_OPENAI_API_KEY or Entra ID (@azure/identity)
45
+ # AZURE_OPENAI_ENDPOINT=
46
+ # AZURE_OPENAI_API_KEY=
47
+ # ANTHROPIC_BASE_URL= / OPENAI_BASE_URL= # an internal proxy in front of the vendor API
48
+ # ANTHROPIC_MODEL_MAP={"claude-sonnet-4-6":"us.anthropic.claude-sonnet-4-6-v1:0"}
49
+ # OPENAI_MODEL_MAP={"gpt-5-mini":"my-azure-deployment"}
50
+ # GEMINI_MODEL_MAP={}
51
+
52
+ # ── Optional: xAI / Grok ──────────────────────────────────────────────────────
53
+ # Required only when using grok-* model identifiers in YAML.
54
+ # Get your key at: https://console.x.ai
55
+ XAI_API_KEY=
56
+
57
+ # XAI_COLLECTION_IDS: comma-separated xAI Collection ids searched by the
58
+ # `collections_search` tool (grok-* agents only). Create collections and
59
+ # upload documents at console.x.ai. Declared with no ids set, the tool is
60
+ # omitted with a warning. Optional cap: XAI_COLLECTIONS_MAX_RESULTS.
61
+ # XAI_COLLECTION_IDS=collection_abc123,collection_def456
62
+ # XAI_COLLECTIONS_MAX_RESULTS=10
63
+
64
+ # Optional server-side constraints for the x_search tool (grok-* agents only).
65
+ # Dates are YYYY-MM-DD (inclusive); handle lists are comma-separated (max 20,
66
+ # leading @ tolerated) and mutually exclusive β€” if both are set the allowlist
67
+ # wins. Malformed values degrade with a warning, never fatally.
68
+ # XAI_X_SEARCH_FROM_DATE=2026-08-01
69
+ # XAI_X_SEARCH_TO_DATE=2026-08-08
70
+ # XAI_X_SEARCH_ALLOWED_HANDLES=Reuters,AP
71
+ # XAI_X_SEARCH_EXCLUDED_HANDLES=spam_account
72
+
73
+ # Optional server-side domain filters for the web_search tool on grok-* agents
74
+ # (comma-separated, max 5, mutually exclusive β€” allowlist wins if both set;
75
+ # OpenAI's web_search ignores these and always ships bare). NOTE: xAI's
76
+ # web_search accepts NO date bounds β€” from_date/to_date are x_search-only.
77
+ # XAI_WEB_SEARCH_ALLOWED_DOMAINS=reuters.com,apnews.com
78
+ # XAI_WEB_SEARCH_EXCLUDED_DOMAINS=pinterest.com
79
+
80
+ # ── Optional: Supabase (Session Persistence & Long-Term Memory) ───────────────
81
+ # Required when memory_system is "session-only" or "long-term" in a syndicate YAML.
82
+ # Without these, the framework falls back to in-memory sessions (no persistence).
83
+ #
84
+ # Setup: Create a free project at https://supabase.com, then go to:
85
+ # Project Settings β†’ API β†’ Project URL β†’ paste below as SUPABASE_URL
86
+ # Project Settings β†’ API β†’ service_role key β†’ paste below as SUPABASE_SERVICE_ROLE_KEY
87
+ #
88
+ # Install the schema before sessions and memory will work:
89
+ # npx melchizedek-db print (paste into the Supabase SQL Editor), or
90
+ # npx melchizedek-db apply (with DATABASE_URL set; needs psql)
91
+ # Clone: npm run db -- print | apply. It runs db/migrations/*.sql, then db/hardening.sql.
92
+ SUPABASE_URL=
93
+ SUPABASE_SERVICE_ROLE_KEY=
94
+
95
+ # ── Optional: Telemetry Sink ──────────────────────────────────────────────────
96
+ # Set to "true" (with the Supabase credentials above) to persist every model
97
+ # request's tokens/latency (llm.request spans) and syndicate-run spans to the
98
+ # adk_telemetry table. Provision it first: run db/telemetry.sql in the Supabase
99
+ # SQL Editor, then re-run db/hardening.sql. See DOCUMENTATION.md Β§5.
100
+ TELEMETRY_SUPABASE=false
101
+
102
+ # ── Optional: A2A Server ──────────────────────────────────────────────────────
103
+ # A2A_SERVER_SECRET: Bearer token used to authenticate incoming A2A requests.
104
+ # If set, all requests must include: Authorization: Bearer <this_value>
105
+ # If not set, the A2A server runs without authentication and binds 127.0.0.1 only.
106
+ # Generate one with: openssl rand -hex 32
107
+ # REQUIRED in production: if PUBLIC_URL is set, the server REFUSES TO START
108
+ # without this secret, to avoid exposing an unauthenticated endpoint.
109
+ A2A_SERVER_SECRET=
110
+
111
+ # PUBLIC_URL: The publicly accessible base URL of the A2A server.
112
+ # Used when compiling the AgentCard that advertises this agent to A2A clients.
113
+ # Defaults to http://localhost:4000 if not set.
114
+ # Only needed for cloud deployments where the server has a real public URL.
115
+ PUBLIC_URL=
116
+
117
+ # ── A2A server: identity and billing (all optional; ADR 0017, 0025) ─────────
118
+ # A2A_AUTH decides who a caller is, and so whose data a request touches:
119
+ # secret (default) every caller presents A2A_SERVER_SECRET; the calling
120
+ # backend names its end user in X-User-Id.
121
+ # callers one bearer token per calling backend. Each owns a scope, stable
122
+ # across model-key rotation. A2A_SERVER_SECRET, if still set, keeps
123
+ # working beside them (old scoping) while callers move over.
124
+ # jwt a JWT from your identity provider; the scope comes from its claims.
125
+ # header an authenticating gateway in front sets the user header; requires
126
+ # A2A_SERVER_SECRET, which only the gateway holds.
127
+ # A2A_AUTH=secret
128
+ # callers: `name:sha256[:scope]` entries separated by ';'. The config holds only
129
+ # each token's SHA-256. Mint one: npx melchizedek-serve --new-caller <name>
130
+ # A2A_CALLERS=
131
+ # jwt: a JWKS URL (RS256/ES256) or an HS256 secret of 32+ characters.
132
+ # A2A_JWT_JWKS_URL=https://your-idp.example/.well-known/jwks.json
133
+ # A2A_JWT_SECRET=
134
+ # A2A_JWT_ISSUER=https://your-idp.example/
135
+ # A2A_JWT_AUDIENCE=melchizedek
136
+ # A2A_JWT_SCOPE_CLAIM=sub
137
+ # A2A_JWT_TENANT_CLAIM=
138
+ # header: the header your gateway sets after authenticating the user.
139
+ # A2A_TRUSTED_USER_HEADER=X-Authenticated-User
140
+ # A2A_KEY_MODE: who pays for models. server (default): the server's own keys.
141
+ # byok: each caller's X-API-Key funds its X-Provider. With A2A_AUTH=secret,
142
+ # byok also scopes data by a hash of that key (the pre-0.16 behaviour).
143
+ # A2A_KEY_MODE=server
144
+ # Bare agent ids that load from the adk_agent_registry table (comma list).
145
+ # Every other bare id is a file; registry:<id> always means the registry.
146
+ # A2A_REGISTRY_AGENTS=
147
+
148
+ # ── A2A server: binding, limits, lifecycle (all optional) ─────────────────────
149
+ # Without A2A_SERVER_SECRET the server binds 127.0.0.1 only. To bind another
150
+ # address without a secret you must also set ALLOW_UNAUTHENTICATED=true.
151
+ # PORT=4000
152
+ # HOST=0.0.0.0
153
+ # ALLOW_UNAUTHENTICATED=false
154
+ # The server refuses a database behind the migrations it ships (run
155
+ # `npx melchizedek-db apply`); this starts it anyway.
156
+ # ALLOW_SCHEMA_MISMATCH=false
157
+ # Only these agent ids are served at /<agentId>/... (comma list). Unset = any
158
+ # syndicate the loader can find.
159
+ # A2A_SERVED_AGENTS=support_triage,research_brief
160
+ # Per-task wall-clock budget (ms; 0 = none). Default 15 minutes.
161
+ # A2A_TASK_TIMEOUT_MS=900000
162
+ # Stream answers token by token on message/stream, as an `answer` artifact
163
+ # (syndicates with guards never stream).
164
+ # A2A_STREAM_TEXT=true
165
+ # How long a second message on a busy conversation waits for the running
166
+ # turn before it is rejected (ms).
167
+ # A2A_TURN_LOCK_WAIT_MS=30000
168
+ # Count the rate limits in Redis, one window across replicas (needs
169
+ # `npm install redis`).
170
+ # A2A_REDIS_URL=redis://localhost:6379
171
+ # Concurrent tasks across all agents (0 = unlimited).
172
+ # A2A_MAX_CONCURRENT_TASKS=0
173
+ # Task submissions per window per client IP, and failed logins before an IP is blocked.
174
+ # A2A_RATE_LIMIT_MAX=60
175
+ # A2A_RATE_LIMIT_WINDOW_MS=900000
176
+ # A2A_AUTH_FAILURE_MAX=30
177
+ # Express trust-proxy: proxy hop count, true/false, or a subnet list. Default 1.
178
+ # A2A_TRUST_PROXY=1
179
+ # A2A_BODY_LIMIT=1mb
180
+ # How long SIGTERM waits for running tasks before canceling them.
181
+ # A2A_SHUTDOWN_GRACE_MS=25000
182
+ # Daily budgets per UTC day (ADR 0026), per caller and per scope (one end
183
+ # user), on tasks, model calls and tokens. A task over budget ends `rejected`
184
+ # with the reason. Counted in Postgres/Supabase (db/migrations/0004) when
185
+ # configured, else in process memory.
186
+ # A2A_BUDGETS={"perCaller":{"tokens":5000000},"callers":{"reports":{"tasks":100}},"perScope":{"tasks":50}}
187
+ # Bearer token for GET /metrics (Prometheus). Unset = no metrics route.
188
+ # A2A_METRICS_TOKEN=
189
+ # text (default) or json: one JSON object per line, with a `task` record per task.
190
+ # A2A_LOG_FORMAT=text
191
+ # Postgres for every durable store (sessions, memory, A2A tasks, erase), safe
192
+ # across instances (ADR 0021); also what `melchizedek-db apply` connects to.
193
+ # Without it: Supabase when its credentials are set, else process memory.
194
+ # DATABASE_URL=
195
+ # Connection counts per instance: the storage pool, and one connection per
196
+ # running turn for the conversation lock. Behind Supabase's session-mode
197
+ # pooler (port 5432) keep their sum under its client limit.
198
+ # DATABASE_POOL_MAX=10
199
+ # A2A_TURN_LOCK_POOL_MAX=20
200
+ # The Postgres schema the tables live in (default public). A private schema
201
+ # such as `melchizedek` keeps them off a Supabase REST layer; install into it
202
+ # with `melchizedek-db apply --schema <name>` (or this variable) and run the
203
+ # server with the same value. Needs DATABASE_URL.
204
+ # MELCHIZEDEK_DB_SCHEMA=public
205
+
206
+ # ── Optional: Knowledge Bundle (wiki) ─────────────────────────────────────────
207
+ # WIKI_ROOT: filesystem path of the OKF knowledge bundle the wiki tools serve.
208
+ # Defaults to <repo>/wiki (this repo ships its bundle there). Point it at any
209
+ # other OKF bundle β€” the tooling is bundle-agnostic (npm run wiki:init).
210
+ WIKI_ROOT=
211
+
212
+ # MCP_WIKI_PORT: port for the wiki MCP server (npm run mcp:wiki). Default 8933.
213
+ MCP_WIKI_PORT=
214
+
215
+ # WIKI_AGENT_MODEL: model for wiki_query / wiki_garden. Any registry-routable
216
+ # string (gemini-*, claude-*, ollama/*, ...). Default: gemini-3.8-flash.
217
+ WIKI_AGENT_MODEL=
218
+
219
+ # ── Optional: one gateway key for providers you have no key for ───────────────
220
+ # A model whose direct key is ABSENT is served through the gateway's OpenAI-
221
+ # compatible endpoint (native search tools are dropped on that path; the
222
+ # doctor says which). A present direct key always wins.
223
+ # MODEL_GATEWAY=vercel # or openrouter
224
+ # MODEL_GATEWAY_API_KEY=
225
+ # MODEL_GATEWAY_BASE_URL= # optional: a self-hosted proxy speaking the same dialect
226
+ # MODEL_GATEWAY_MODEL_MAP= # optional: "claude-sonnet-4-6=anthropic/claude-sonnet-4.6,..."
227
+
228
+ # ── Optional: tracing ─────────────────────────────────────────────────────────
229
+ # Send every span to any OTLP/HTTP backend (Phoenix, Langfuse, Jaeger, Tempo):
230
+ # a local Phoenix is `docker run -p 6006:6006 arizephoenix/phoenix`.
231
+ # OTEL_EXPORTER_OTLP_ENDPOINT=http://localhost:6006
232
+ # OTEL_SERVICE_NAME=melchizedek
233
+ # Print [OTEL_SPAN_JSON] lines to stdout. Off by default: the root span carries
234
+ # the full user message and answer.
235
+ # OTEL_CONSOLE_SPANS=false
236
+ # Which model calls keep their full request/response in adk_payloads
237
+ # (off | errors | sample | all), the sample fraction, and the expiry.
238
+ # TELEMETRY_PAYLOADS=sample
239
+ # TELEMETRY_PAYLOAD_SAMPLE=0.10
240
+ # TELEMETRY_PAYLOAD_TTL_DAYS=30
241
+ # TELEMETRY_REDACT: what is scrubbed from every ledger row before it is written
242
+ # (lib/observability/redact.ts). secret (default) = key-shaped credentials;
243
+ # add any of email, phone, card, ssn (comma list), or all, or off.
244
+ # TELEMETRY_REDACT=secret
245
+
246
+ # ── Optional: misc ────────────────────────────────────────────────────────────
247
+ # Where syndicate YAMLs are found. Default: <cwd>/config/agents.
248
+ # MELCHIZEDEK_AGENTS_DIR=
249
+ # Bearer credentials for MCP servers that need one: a JSON object of
250
+ # hostname β†’ token, sent only to that exact host and only over https.
251
+ # MCP_BEARER_TOKENS={"mcp.example.com":"..."}
252
+ # Per-page character budget for web_extract (default 15000).
253
+ # WEB_EXTRACT_CHAR_LIMIT=15000
254
+
255
+ # ── Optional: provider retries ────────────────────────────────────────────────
256
+ # Transient provider failures (408/409/425/429/5xx, connection resets) are
257
+ # retried with jittered backoff, honouring Retry-After up to 60 s, before any
258
+ # output is produced. Total attempts per model call; 1 turns retries off.
259
+ # MODEL_RETRY_MAX_ATTEMPTS=3
260
+ # Per-attempt timeout for xAI (Grok) calls, ms; floor 120000.
261
+ # XAI_TIMEOUT_MS=600000
262
+
263
+ # ── Optional: long-term memory providers ──────────────────────────────────────
264
+ # Fact extraction runs on any model id (routed like an agent's model); the
265
+ # embedder is gemini (default), openai, ollama or any OpenAI-compatible
266
+ # endpoint. The dimension must match the vector column (768 in db/migrations).
267
+ # MEMORY_EXTRACTION_MODEL=gemini-3.8-flash
268
+ # MEMORY_EMBEDDING_PROVIDER=gemini
269
+ # MEMORY_EMBEDDING_MODEL=
270
+ # MEMORY_EMBEDDING_DIMENSIONS=768
271
+ # MEMORY_EMBEDDING_BASE_URL= # required for openai-compatible
272
+ # MEMORY_EMBEDDING_API_KEY= # for openai-compatible
package/AGENT_SETUP.md CHANGED
@@ -5,7 +5,7 @@ the way people actually work now: your coding agent (Claude Code,
5
5
  Cursor, Codex β€” any of them) does the machine steps, you do the human
6
6
  steps, and the seams between the two are explicit.
7
7
 
8
- Repo: https://github.com/jhwadman/melchizedek-agents
8
+ Repo: https://github.com/jhwadman/melch-ai
9
9
  Course: https://lyceumagents.com/curriculum/
10
10
  This file lives in both places and is identical in both.
11
11
 
@@ -19,8 +19,8 @@ Set up the melchizedek-agents framework on this machine.
19
19
  1. Check prerequisites: `node --version` must be 22 or newer. If it
20
20
  isn't, stop and tell me before doing anything else.
21
21
  2. Clone and install:
22
- git clone https://github.com/jhwadman/melchizedek-agents.git
23
- cd melchizedek-agents
22
+ git clone https://github.com/jhwadman/melch-ai.git
23
+ cd melch-ai
24
24
  npm install
25
25
  3. Create my env file: `cp .env.example .env`. Do NOT put any values in
26
26
  it. Never ask me to paste API keys into this chat, never read keys
@@ -49,10 +49,10 @@ conversation's history forever. The stop-conditions keep the agent from
49
49
  After the agent reports back:
50
50
 
51
51
  1. **Optional β€” zero keys, fully local**: install Ollama
52
- (https://ollama.com) and run `ollama pull qwen3:8b`. The two
53
- open-weight syndicates (`npm run syndicate:tutor`, `npm run
54
- syndicate:council`) then run with an empty `.env` β€” every agent is a
55
- local model, nothing leaves your machine. This is the open-weight course
52
+ (https://ollama.com) and run `ollama pull qwen3:8b`. The three
53
+ open-weight syndicates (`npm run syndicate:assistant`, `npm run
54
+ syndicate:tutor`, `npm run syndicate:council`) then run with an empty
55
+ `.env` β€” every agent is a local model, nothing leaves your machine. This is the open-weight course
56
56
  path; the cloud syndicates below still want a key.
57
57
  2. **Get a Gemini API key** (free): https://aistudio.google.com β†’
58
58
  create key β†’ open `.env` in your editor and set
@@ -70,17 +70,28 @@ After the agent reports back:
70
70
  of them β€” set only what you'll declare in YAML:
71
71
  `ANTHROPIC_API_KEY` for `claude-*` (https://console.anthropic.com),
72
72
  `OPENAI_API_KEY` for `gpt-*` (https://platform.openai.com/api-keys),
73
- `XAI_API_KEY` for `grok-*` (https://console.x.ai). Verify the whole
74
- multi-provider surface at any time with `npm run demo:models` β€” it
75
- sends one prompt to every provider you've configured (plus the local
76
- model) and prints per-request token/latency traces; unconfigured
77
- providers are skipped.
73
+ `XAI_API_KEY` for `grok-*` (https://console.x.ai). Not sure which
74
+ you need? `npm run doctor` reads every syndicate and prints what is
75
+ ready, what is blocked, and which variable unlocks what β€” read-only,
76
+ no key value shown. Verify the whole multi-provider surface live with
77
+ `npm run demo:models` β€” it sends one prompt to every provider you've
78
+ configured (plus the local model) and prints per-request token/latency
79
+ traces; unconfigured providers are skipped.
80
+ 5. **Optional β€” one key instead of several**: `MODEL_GATEWAY=vercel` (or
81
+ `openrouter`) plus `MODEL_GATEWAY_API_KEY` serves any cloud model id
82
+ whose direct key is absent through that gateway. It is a fallback: a
83
+ direct key set beside it always wins for its own provider, and adding
84
+ one later restores that provider's native search. Through the gateway,
85
+ Gemini grounding, Anthropic/OpenAI `web_search` and xAI `x_search` are
86
+ lost β€” the doctor says so per agent.
78
87
 
79
88
  ## 3. First tests β€” meet the agents
80
89
 
81
90
  Keyless, if you installed Ollama:
82
91
 
83
92
  ```bash
93
+ npm run syndicate:assistant # converse, summarize, keep a task list, queue background jobs
94
+ npm run assistant:worker # (second terminal) runs the jobs the Assistant queues
84
95
  npm run syndicate:tutor # one open-weight agent: name a topic or paste material, be taught
85
96
  npm run syndicate:council # advocate/skeptic council, all local
86
97
  ```
@@ -150,22 +161,26 @@ application calls like any other API:
150
161
  `A2A_SERVER_SECRET` in `.env`.
151
162
  2. `npm run start:a2a` β€” the endpoint speaks the open A2A protocol,
152
163
  publishes an agent card, and enforces bearer auth + rate limiting.
153
- 3. Every request carries three headers: `Authorization: Bearer
154
- <A2A_SERVER_SECRET>`, `X-API-Key: <a Gemini key>` (inference bills
155
- the caller β€” your server key stays yours), and `X-User-Id: <your
156
- app's opaque user id>` β€” the id your backend assigns after
157
- authenticating its own user, never one the user chooses. That last
158
- header is what keeps one user's memory out of another's session.
164
+ 3. Every request carries `Authorization: Bearer <A2A_SERVER_SECRET>`
165
+ and `X-User-Id: <your app's opaque user id>` β€” the id your backend
166
+ assigns after authenticating its own user, never one the user
167
+ chooses. That header is what keeps one user's sessions and memory out
168
+ of another's. The server's own provider keys pay for inference. (To
169
+ make callers fund their own, set `A2A_KEY_MODE=byok`; each request
170
+ then also carries `X-API-Key`.) To give each calling backend its own
171
+ token instead of the shared secret, set `A2A_AUTH=callers` and mint
172
+ one per caller with `npx melchizedek-serve --new-caller <name>`; for
173
+ your identity provider's JWTs, `A2A_AUTH=jwt` (DOCUMENTATION.md Β§6).
159
174
  4. `demo/a2a_demo.mjs` is a complete working client; `DOCUMENTATION.md`
160
- Β§A2A has the protocol details, and `lib/memory/README.md` covers
161
- per-user memory siloing and the right-to-erasure endpoint before you
175
+ Β§6 is the HTTP reference, and `DELETE /memory` erases everything
176
+ stored for a user β€” facts, transcripts and ledger rows β€” before you
162
177
  serve real people.
163
178
 
164
179
  When you're ready, hand your coding agent a prompt shaped like this:
165
180
 
166
181
  ```text
167
182
  My melchizedek-agents A2A server runs at <URL>. Read demo/a2a_demo.mjs
168
- and DOCUMENTATION.md Β§A2A in the melchizedek-agents repo, then wire my
183
+ and DOCUMENTATION.md Β§A2A in the melch-ai repo, then wire my
169
184
  app's <feature> to it: send each authenticated user's message via
170
185
  message/send with the three required headers, stream or poll the reply,
171
186
  and render it in <where>. The bearer secret and Gemini key come from my
@@ -188,7 +203,8 @@ right place to learn. When a syndicate of yours deserves its own
188
203
  repository, the same engine installs as a typed npm dependency β€”
189
204
  `npm install melchizedek-agents` β€” with the starter pack inside the
190
205
  package to copy from, `loadSyndicate` reading your repo's own
191
- `config/agents/`, and the two CLIs (`npx melchizedek-chat`,
192
- `npx melchizedek-serve`) replacing the npm scripts. QUICKSTART Β§7 in the
206
+ `config/agents/`, and its CLIs (`npx melchizedek-chat`,
207
+ `npx melchizedek-serve`, `npx melchizedek-worker`) replacing the npm
208
+ scripts. QUICKSTART Β§7 in the
193
209
  repo is the complete recipe; hand it to your coding agent when the time
194
210
  comes.