Skip to content

Commit c4846e6

Browse files
hyperpolymathclaude
andcommitted
docs(cartridge): scaffold RSR essentials for echidna-llm-mcp
Cartridge previously had only README.adoc + docs/CALL-PROTOCOL.adoc. Add the RSR-canonical essentials that bring it to D-grade conformance on its own (rather than relying purely on parent boj-server scaffolding): - LICENSE MPL-2.0 (legal fallback for PMPL-1.0-or-later, copied from parent) - SECURITY.md Cartridge-specific notes + pointer to parent's reporting flow - CONTRIBUTING.md Cartridge-specific contribution guidance + parent pointer - EXPLAINME.adoc README claims with evidence and caveats - .machine_readable/6a2/{STATE,META,ECOSYSTEM,AGENTIC,NEUROSYM,PLAYBOOK,ANCHOR}.a2ml The 6a2 set is minimal-but-valid: - STATE.a2ml: 90% complete, recent commits captured (Zig 0.15 fix, V-lang sweep), no current blockers - META.a2ml: 3 ADRs (V-lang retirement, Zig 0.15 module-first build, slug-based prover addressing) - ECOSYSTEM.a2ml: 8 downstream consumers found in earlier audit, plus upstream relationship to echidna and hosting in boj-server. Notes the echidnabot-mcp exception alongside. - AGENTIC.a2ml: agent perms + constraints (no V-lang, no npm, no hardcoded slugs) - NEUROSYM.a2ml: declares cartridge is pure transport — no local models - PLAYBOOK.a2ml: incident response for the 3 most likely failures (echidna down, unknown slug, Zig version mismatch) - ANCHOR.a2ml: id, parents (boj-server + echidna), recalibration triggers License/security/contributing files all explicitly defer to the parent boj-server for the canonical flow — cartridge sovereignty ends at the ABI surface; parent owns trust + threat model. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent cc25b77 commit c4846e6

11 files changed

Lines changed: 880 additions & 0 deletions

File tree

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# AGENTIC.a2ml — AI agent constraints + capabilities for echidna-llm-mcp
5+
6+
[metadata]
7+
version = "1.0.0"
8+
last-updated = "2026-04-25"
9+
10+
[agent-permissions]
11+
can-edit-source = true # mod.js, ffi/, adapter/
12+
can-edit-tests = true # ffi tests
13+
can-edit-docs = true # CALL-PROTOCOL, README, EXPLAINME
14+
can-edit-config = true # cartridge.json
15+
can-edit-protocol = false # ABI changes need parent boj-server review
16+
17+
[agent-constraints]
18+
# What agents must NOT do:
19+
# - Add new tools without updating CALL-PROTOCOL.adoc
20+
# - Hardcode prover slugs (delegate to echidna's provers.a2ml at runtime)
21+
# - Bypass the parent BoJ loader for production traffic
22+
# - Use V-lang (banned 2026-04-10) — Zig only
23+
# - Use npm/Bun/pnpm — Deno only
24+
# - Use believe_me / unsafeCoerce / Obj.magic / similar dangerous patterns
25+
26+
[automation-hooks]
27+
# on-enter: Read parent boj-server STATE.a2ml + this STATE.a2ml + CALL-PROTOCOL
28+
# on-edit-tool: Update CALL-PROTOCOL.adoc + bump cartridge.json version
29+
# on-build-fail: Check Zig version >= 0.15.2; check FFI exports marked `pub`
30+
# on-commit: Run zig build + zig build test on FFI changes
31+
32+
[trust-policy]
33+
inherits-from = "boj-server (loader, signature verification, threat model)"
34+
adds = "none — cartridge introduces no new privileged operations"
35+
36+
[exceptions]
37+
# No carve-outs from estate-wide rules at the cartridge level.
38+
# The companion echidnabot-mcp is a documented exception in its own
39+
# AGENTIC.a2ml — sunsets to fold back into a BoJ cartridge.
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# ⚓ ANCHOR: echidna-llm-mcp
5+
# Canonical identity + recalibration anchor for the echidna-llm-mcp BoJ
6+
# cartridge.
7+
8+
id = "org.hyperpolymath.boj-server.cartridges.echidna-llm-mcp"
9+
version = "0.3.0"
10+
clade = "boj-cartridge"
11+
status = "active"
12+
13+
# No SSG — cartridge is a runtime component, not a static-site source.
14+
15+
[relationships]
16+
parents = [
17+
"org.hyperpolymath.boj-server", # hosted in (loader)
18+
"org.hyperpolymath.echidna", # delegated to (proof engine)
19+
]
20+
21+
siblings = [
22+
# All other boj-server cartridges
23+
]
24+
25+
[recalibration]
26+
# When this anchor becomes stale, walk the following:
27+
# 1. Verify echidna REST surface compatibility (docs/CALL-PROTOCOL.adoc vs echidna's actual endpoints)
28+
# 2. Check Zig version still supported (currently 0.15.2+)
29+
# 3. Confirm cartridge ABI compatibility with current boj-server loader
30+
# 4. Re-verify slug catalogue alignment (echidna's provers.a2ml unchanged enums)
31+
triggers = [
32+
"echidna major version bump",
33+
"boj-server loader ABI change",
34+
"Zig stdlib API breaking change (next major)",
35+
]
Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# ECOSYSTEM.a2ml — Position of echidna-llm-mcp in the hyperpolymath stack
5+
6+
[metadata]
7+
version = "1.0.0"
8+
last-updated = "2026-04-25"
9+
10+
[ecosystem]
11+
name = "echidna-llm-mcp"
12+
type = "boj-cartridge"
13+
purpose = "AI-assistant gateway to echidna proof engine"
14+
15+
[position-in-ecosystem]
16+
layer = "transport / shim"
17+
direction = "AI assistants → echidna proof engine"
18+
19+
[upstream-dependencies]
20+
[[upstream-dependencies.dep]]
21+
name = "echidna"
22+
repo = "github.com:hyperpolymath/echidna.git"
23+
relationship = "consumer-of"
24+
purpose = "All proof operations are delegated to echidna's REST API"
25+
contract = "REST endpoints documented in docs/CALL-PROTOCOL.adoc"
26+
27+
[[upstream-dependencies.dep]]
28+
name = "boj-server"
29+
repo = "github.com:hyperpolymath/boj-server.git"
30+
relationship = "hosted-in"
31+
purpose = "Loader, security policy, FFI primitives, threat-model"
32+
contract = "Cartridge ABI per boj-server/cartridges/README.adoc"
33+
34+
[downstream-consumers]
35+
# Repos that invoke this cartridge (as found in 2026-04-24 estate audit):
36+
referenced-from = [
37+
"aspasia",
38+
"panll",
39+
"007-lang",
40+
"proven-servers",
41+
"typell",
42+
"nesy-solver",
43+
"absolute-zero",
44+
"boj-server (parent — TOPOLOGY.md)",
45+
]
46+
47+
[related-projects]
48+
[[related-projects.project]]
49+
name = "echidnabot"
50+
relationship = "sibling-actuator"
51+
note = """
52+
Echidnabot also calls echidna for proof verification, but goes via
53+
echidna's REST API directly (not through this cartridge). Echidnabot
54+
ships a separate native MCP server (echidnabot-mcp) as a documented
55+
BoJ-only-MCP exception — see echidnabot/.machine_readable/6a2/AGENTIC.a2ml
56+
[exceptions.boj-only-mcp]. This cartridge remains the canonical
57+
BoJ-mediated MCP surface for echidna.
58+
"""
59+
60+
[invariants]
61+
canonical-mcp-surface = "This cartridge is the canonical BoJ-mediated MCP surface for echidna. All MCP-shaped traffic to echidna SHOULD route through here."
62+
echidnabot-exception = "Echidnabot's standalone MCP bin is a temporary exception, sunsets when BoJ loader supports double-loop feedback protocol."
Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# META.a2ml — Architecture decisions for echidna-llm-mcp
5+
6+
[metadata]
7+
version = "1.0.0"
8+
last-updated = "2026-04-25"
9+
10+
[project-info]
11+
license = "PMPL-1.0-or-later"
12+
license-fallback = "MPL-2.0"
13+
author = "Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>"
14+
parent-repo = "hyperpolymath/boj-server"
15+
16+
[architecture-decisions]
17+
18+
[[architecture-decisions.decision]]
19+
id = "ADR-CART-001"
20+
date = "2026-04-10"
21+
status = "accepted"
22+
title = "V-lang adapter retired in favour of Zig"
23+
context = """
24+
V-lang was banned estate-wide on 2026-04-10. The cartridge's V-lang
25+
intermediate adapter was deleted; Zig is the canonical native FFI
26+
language going forward.
27+
"""
28+
consequences = """
29+
- adapter/ now contains Zig sources only
30+
- Build requires Zig 0.15.2+ (see ADR-CART-002)
31+
- Deno mod.js remains the canonical default transport for BoJ loader
32+
"""
33+
34+
[[architecture-decisions.decision]]
35+
id = "ADR-CART-002"
36+
date = "2026-04-25"
37+
status = "accepted"
38+
title = "Zig 0.15 module-first build pattern"
39+
context = """
40+
Zig 0.15.2 dropped `.root_source_file` from `Build.ExecutableOptions`.
41+
The cartridge's adapter/build.zig was on the legacy 0.14 API. Migrated
42+
to the module-first pattern (createModule → addExecutable with
43+
.root_module). All 16 export fns in the FFI were also marked `pub`
44+
to satisfy 0.15's cross-module visibility check.
45+
"""
46+
consequences = """
47+
- Single supported Zig: 0.15.2+ (no 0.14 fallback)
48+
- FFI now usable both as Zig module imports (Zig consumers) and via
49+
C ABI symbol table (BoJ loader)
50+
"""
51+
52+
[[architecture-decisions.decision]]
53+
id = "ADR-CART-003"
54+
date = "2026-04-20"
55+
status = "accepted"
56+
title = "Slug-based prover addressing"
57+
context = """
58+
Echidna ships ~113 prover backends. Hardcoding the list in the cartridge
59+
would require a cartridge bump on every echidna prover addition. Decision:
60+
the cartridge accepts a `prover` slug string and delegates resolution to
61+
echidna at request time. The catalogue lives upstream in
62+
echidna/.machine_readable/provers.a2ml.
63+
"""
64+
consequences = """
65+
- Cartridge is forward-compatible with echidna prover additions
66+
- Invalid slugs surface as echidna-side 404, not cartridge errors
67+
- Discovery: callers list provers via the dedicated tool (see
68+
docs/CALL-PROTOCOL.adoc)
69+
"""
70+
71+
[development-practices]
72+
build-tool = "zig build (adapter), no build for Deno path"
73+
test-runner = "zig build test (FFI), Deno test suite (mod.js)"
74+
ci = "inherits from boj-server parent repo"
75+
spdx = "required on all source files"
76+
language-policy = "Zig 0.15.2+, Deno (no Node/npm), no V-lang"
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# NEUROSYM.a2ml — Neurosymbolic integration config for echidna-llm-mcp
5+
6+
[metadata]
7+
version = "1.0.0"
8+
last-updated = "2026-04-25"
9+
10+
[role]
11+
# This cartridge does not perform any symbolic reasoning or neural inference
12+
# itself. It is a transport shim. Both layers live upstream in echidna:
13+
# - symbolic: provers/, verification/, dispatch.rs
14+
# - neural: src/julia/ (GNN, premise selection, tactic ranking)
15+
16+
is-symbolic-engine = false
17+
is-neural-engine = false
18+
exposes-neurosym = true # via echidna's combined endpoints
19+
20+
[exposed-tools]
21+
# Tools that route to neurosymbolic backends in echidna:
22+
[[exposed-tools.tool]]
23+
name = "suggest_tactics"
24+
neural-component = "echidna /gnn/rank (Julia GNN endpoint)"
25+
symbolic-component = "echidna prover dispatch"
26+
27+
[[exposed-tools.tool]]
28+
name = "rank_premises"
29+
neural-component = "echidna /gnn/rank"
30+
symbolic-component = "premise filter"
31+
32+
[hypatia-scanning]
33+
# Hypatia (estate-wide neurosymbolic CI/CD intelligence) scans this
34+
# cartridge as part of boj-server's parent scan. No cartridge-specific
35+
# Hypatia config needed.
36+
inherits-from = "boj-server"
37+
38+
[invariants]
39+
no-local-models = "This cartridge ships no model weights, no inference code. All AI happens upstream in echidna."
40+
no-bypass = "Tool callers cannot reach echidna's neural endpoints by other means through this cartridge — only the documented suggest_tactics / rank_premises path."
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# PLAYBOOK.a2ml — Operational runbook for echidna-llm-mcp
5+
6+
[metadata]
7+
version = "1.0.0"
8+
last-updated = "2026-04-25"
9+
10+
[deployment]
11+
# Cartridge is deployed as part of boj-server. No standalone deployment.
12+
loader = "boj-server"
13+
loader-loads-via = "Deno mod.js (default) or Zig adapter binary (optional)"
14+
typical-port = "delegated to BoJ loader; no cartridge-owned port"
15+
16+
[runtime-config]
17+
# Configuration sources, in precedence order:
18+
# 1. BoJ loader env (passes through)
19+
# 2. cartridge.json static defaults
20+
# 3. Code-baked defaults (e.g. http://127.0.0.1:7700 for Zig adapter)
21+
[[runtime-config.var]]
22+
name = "BOJ_ENDPOINT"
23+
read-by = "Zig adapter only"
24+
default = "http://127.0.0.1:7700"
25+
purpose = "BoJ server URL the adapter forwards to"
26+
27+
[[runtime-config.var]]
28+
name = "ECHIDNA_ENDPOINT"
29+
read-by = "Deno mod.js"
30+
default = "http://127.0.0.1:8081"
31+
purpose = "Echidna REST API endpoint"
32+
33+
[incident-response]
34+
[[incident-response.scenario]]
35+
trigger = "All tool calls return 503 / connection refused"
36+
likely-cause = "Echidna REST endpoint down"
37+
diagnose = "curl ${ECHIDNA_ENDPOINT}/api/health"
38+
mitigate = "Restart echidna; cartridge has no local fallback"
39+
40+
[[incident-response.scenario]]
41+
trigger = "Tool call returns 'unknown prover slug'"
42+
likely-cause = "Slug not in echidna's current ProverKind enum"
43+
diagnose = "curl ${ECHIDNA_ENDPOINT}/api/v1/provers — compare against requested slug"
44+
mitigate = "Use a valid slug from the returned list, or upgrade echidna"
45+
46+
[[incident-response.scenario]]
47+
trigger = "Zig adapter fails to start"
48+
likely-cause = "Zig version < 0.15.2 OR libc not linked"
49+
diagnose = "zig version; check adapter/build.zig has .link_libc = true"
50+
mitigate = "Upgrade Zig; or fall back to Deno mod.js path"
51+
52+
[release]
53+
versioning = "semver, in cartridge.json"
54+
release-procedure = "inherits from boj-server release flow"
55+
breaking-change-policy = "Tool removal or signature change requires major bump + update CALL-PROTOCOL.adoc"
56+
57+
[backup]
58+
# Cartridge is stateless. No backup needed.
59+
stateful = false
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
# SPDX-License-Identifier: PMPL-1.0-or-later
2+
# Copyright (c) 2026 Jonathan D.A. Jewell <j.d.a.jewell@open.ac.uk>
3+
#
4+
# STATE.a2ml — echidna-llm-mcp cartridge state
5+
6+
[metadata]
7+
project = "echidna-llm-mcp"
8+
version = "0.3.0"
9+
last-updated = "2026-04-25"
10+
status = "active"
11+
12+
[project-context]
13+
name = "echidna-llm-mcp"
14+
purpose = """
15+
BoJ cartridge exposing echidna's proof engine to AI assistants via
16+
JSON-RPC. 15 tools mapping 1:1 to echidna REST endpoints, addressable
17+
across all 113 ProverKind variants by slug.
18+
"""
19+
completion-percentage = 90
20+
21+
[position]
22+
phase = "production"
23+
maturity = "stable"
24+
25+
[components]
26+
deno-transport = { status = "shipping", path = "mod.js" }
27+
zig-adapter = { status = "shipping", path = "adapter/", note = "Zig 0.15.2 build fix landed afbab20 (2026-04-25)" }
28+
ffi = { status = "shipping", path = "ffi/echidna_llm_ffi.zig" }
29+
call-protocol = { status = "shipping", path = "docs/CALL-PROTOCOL.adoc" }
30+
31+
[dependencies]
32+
parent-repo = "boj-server (loader, security, threat-model)"
33+
upstream = "echidna (REST endpoints, prover catalogue)"
34+
35+
[blockers-and-issues]
36+
issues = []
37+
38+
[critical-next-actions]
39+
actions = [
40+
"Track echidna REST surface drift — when echidna gains new endpoints, mirror in CALL-PROTOCOL.adoc",
41+
"Watch for BoJ loader signature/auth changes that might affect cartridge invocation",
42+
]
43+
44+
[recent-history]
45+
[[recent-history.entry]]
46+
date = "2026-04-25"
47+
ref = "afbab20"
48+
note = "Zig 0.15.2 cartridge build fix (4 sub-issues: API drift + libc + 16 pub fns + missing init arg)"
49+
50+
[[recent-history.entry]]
51+
date = "2026-04-25"
52+
note = "RSR scaffolding added: LICENSE, SECURITY.md, CONTRIBUTING.md, EXPLAINME.adoc, .machine_readable/6a2/"
53+
54+
[[recent-history.entry]]
55+
date = "2026-04-24"
56+
ref = "1fef110, c5188a8"
57+
note = "V-lang seam sweep — removed historical V-lang references after V-lang ban"

0 commit comments

Comments
 (0)