Skip to content

Commit 5adfa44

Browse files
hyperpolymathclaude
andcommitted
feat: agent-mcp cartridge, build infrastructure, RSR compliance
- Add agent-mcp cartridge (SafeOODA.idr + agent_ffi.zig, 7 tests) OODA loop enforcement: agents cannot skip Observe→Orient→Decide→Act - Add Zig build.zig for all 4 cartridge FFI layers - Add Idris2 .ipkg package files for all 4 cartridges - Customize Justfile with BoJ-specific recipes: typecheck, verify-no-believe-me, verify, matrix, build, test - Customize contractiles for BoJ-server: Trustfile (replace example.com with boj-server values) Mustfile (12 BoJ invariant checks) Intentfile (matrix fill, Umoja, security, PanLL, community) Dustfile (catalogue rollback, federation quarantine) - Fix ANCHOR.a2ml (service/infrastructure, correct language policy) - Remove template instruction blocks from CODE_OF_CONDUCT.md, SECURITY.md - Clean ABI-FFI-README.md template marker - Update .gitignore for cartridge build caches Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent b3577bc commit 5adfa44

21 files changed

Lines changed: 808 additions & 216 deletions

File tree

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ src/abi/build/
104104
# Zig cache
105105
ffi/zig/.zig-cache/
106106
ffi/zig/zig-out/
107+
cartridges/*/ffi/.zig-cache/
108+
cartridges/*/ffi/zig-out/
107109

108110
# Cartridge Idris2 build artifacts
109111
cartridges/*/abi/build/

.machine_readable/anchors/ANCHOR.a2ml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ purpose = [
2020

2121
[identity]
2222
project = "Bundle of Joy Server"
23-
kind = "{{PROJECT_KIND}}" # language | library | service | tool
23+
kind = "service"
2424
one-sentence = "Unified server capability catalogue with formally verified cartridges"
25-
domain = "{{PROJECT_DOMAIN}}"
25+
domain = "infrastructure"
2626

2727
[semantic-authority]
2828
policy = "canonical"
@@ -34,8 +34,8 @@ owns = [
3434
]
3535

3636
[implementation-policy]
37-
allowed = ["Rust", "Idris2", "Zig", "Scheme", "Shell", "Just", "AsciiDoc", "Markdown"]
38-
forbidden = ["Node.js", "npm"]
37+
allowed = ["Idris2", "Zig", "V", "Scheme", "Shell", "Just", "AsciiDoc", "Markdown", "ReScript"]
38+
forbidden = ["Node.js", "npm", "TypeScript", "Python", "Go"]
3939

4040
[golden-path]
4141
smoke-test-command = [
Lines changed: 38 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,45 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
2-
# Dustfile template - recovery and rollback semantics
2+
# Dustfile - recovery and rollback semantics for BoJ Server
33

44
version: 1
55

66
recovery:
7-
logs:
8-
- name: decision-log
9-
path: logs/decisions.json
10-
reversible: true
11-
handler: "log-replay --reverse logs/decisions.json"
12-
13-
policy:
14-
- name: policy-rollback
15-
path: policy/policy.ncl
16-
rollback: "git checkout HEAD~1 -- policy/policy.ncl"
17-
notes: "Rollback policy to the previous known-good revision."
18-
19-
gateway:
20-
- name: bad-deployment
21-
event: "deploy.failure"
22-
undo: "kubectl rollout undo deployment/gateway"
23-
notes: "Undo a failed deployment while preserving audit logs."
7+
catalogue:
8+
- name: catalogue-rollback
9+
path: src/abi/Boj/Catalogue.idr
10+
rollback: "git checkout HEAD~1 -- src/abi/Boj/Catalogue.idr"
11+
notes: "Rollback core catalogue to previous version. Re-run idris2 --check after."
12+
13+
cartridges:
14+
- name: cartridge-rollback
15+
event: "cartridge.mount.failure"
16+
undo: "just clean && just build"
17+
notes: "Clean build and rebuild all FFI layers after a cartridge mount failure."
18+
19+
- name: cartridge-abi-rollback
20+
path: "cartridges/*/abi/**/*.idr"
21+
rollback: "git checkout HEAD~1 -- cartridges/"
22+
notes: "Rollback all cartridge ABIs. Requires re-typecheck."
23+
24+
federation:
25+
- name: node-deregister
26+
event: "umoja.node.attestation.failure"
27+
undo: "Remove node from gossip pool. Quarantine until hash re-verified."
28+
notes: "Community node failed hash attestation. Isolate, do not route orders."
29+
30+
- name: gossip-rollback
31+
event: "umoja.gossip.corruption"
32+
undo: "Reset gossip state to last known-good snapshot."
33+
notes: "If gossip data is corrupted, fall back to seed node registry."
34+
35+
menu:
36+
- name: menu-regenerate
37+
path: .machine_readable/servers/menu.a2ml
38+
rollback: "Regenerate menu.a2ml from catalogue state."
39+
notes: "Menu is derived from catalogue — regenerate rather than rollback."
2440

2541
dust-events:
26-
- name: decision-log-to-dust
27-
source: logs/decisions.json
28-
transform: "dustify --input logs/decisions.json --output logs/dust-events.json"
29-
notes: "Map gateway decision logs into reversible dust events."
42+
- name: ffi-rebuild
43+
source: ffi/zig/
44+
transform: "just clean && just build && just test"
45+
notes: "Full FFI rebuild and test cycle after any Zig source change."
Lines changed: 30 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,38 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
2-
# Intentfile template - declared future intent
2+
# Intentfile - declared future intent for BoJ Server
33

44
version: 1
55

66
future:
7-
trust-engine:
8-
- "Integrate hardware-backed key management."
9-
- "Support node attestation for deployments."
7+
matrix-fill:
8+
- "Fill remaining MCP column: Cloud, Container, K8s, Git, Secrets, Queues, IaC, Observe, SSG, Proof."
9+
- "Begin LSP column for key capability domains."
10+
- "Evaluate DAP column where debugging adapters make sense."
1011

11-
control-plane:
12-
- "Move to GitOps-backed configuration promotion."
13-
- "Add canary and staged rollout support."
12+
umoja-federation:
13+
- "Implement gossip protocol for community node discovery (IPv6-only)."
14+
- "Hash attestation for binary verification of community-hosted nodes."
15+
- "Deploy 4 family seed nodes across 4 continents (UK, Central Europe, Australia, Americas)."
16+
- "Load-aware routing: route orders to healthiest available node."
1417

15-
pipeline:
16-
- "Adopt Nickel (or your DSL) as the primary policy language."
17-
- "Automate policy promotion from dev to prod with signed artifacts."
18+
v-lang-adapter:
19+
- "Triple API adapter: REST (9000) + gRPC (9001) + GraphQL (9002)."
20+
- "Read order-ticket.scm, mount selected cartridges, return endpoints."
21+
- "Status endpoint returns live matrix state."
1822

19-
introspection:
20-
- "Expose decision latency and policy evaluation metrics."
21-
- "Add tracing for end-to-end request decisions."
23+
security:
24+
- "Auto-SDP (Software Defined Perimeter) for community nodes."
25+
- "DoQ/DoH for encrypted DNS resolution on Umoja network."
26+
- "oDNS research: distributed Oblivious DNS as a network service."
27+
- "Container hash state monitoring via vordr integration."
28+
29+
panll-integration:
30+
- "BoJ panel in PanLL showing live capability matrix."
31+
- "Menu browser and order placement from PanLL."
32+
- "A2ML integration: PanLL reads BoJ menu.a2ml for capability discovery."
33+
34+
community:
35+
- "Community cartridge submission process (Ayo menu tier)."
36+
- "Hosting documentation for community node operators."
37+
- "IndieWeb integration: Webmention, self-hosted node discovery."
38+
- "PMPL license as network license for provenance chain verification."
Lines changed: 54 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,68 @@
11
# SPDX-License-Identifier: PMPL-1.0-or-later
2-
# Mustfile - declarative state contract (template)
2+
# Mustfile - declarative state contract for BoJ Server
33
# See: https://github.com/hyperpolymath/mustfile
44

55
version: 1
66

77
metadata:
8-
name: project-state-contract
9-
spec: v0.0.1
10-
description: "Invariant checks for config, policy, gateway, logs, and schema."
8+
name: boj-server-state-contract
9+
spec: v0.1.0
10+
description: "Invariant checks for BoJ capability catalogue, cartridges, and formal proofs."
1111

1212
parameters:
13-
gateway_port: "8080"
14-
schema_version: "v0.0.1"
13+
gateway_port: "9000"
14+
abi_dir: "src/abi"
15+
ffi_dir: "ffi/zig"
1516

1617
checks:
17-
- name: config-valid
18-
description: "config/service.yaml must be valid."
19-
run: "yq -e '.' config/service.yaml >/dev/null"
18+
- name: zero-believe-me
19+
description: "No believe_me, assert_total, or assert_smaller in any Idris2 source."
20+
run: "bash -uc '! grep -rn \"believe_me\\|assert_total\\|assert_smaller\" --include=\"*.idr\" src/ cartridges/ | grep -v -- \"--.*believe_me\" | grep -v \"|||.*believe_me\"'"
2021

21-
- name: policy-compiles
22-
description: "policy/policy.ncl must compile."
23-
run: "nickel check policy/policy.ncl"
22+
- name: abi-typechecks
23+
description: "Core ABI Idris2 files must type-check with %default total."
24+
run: "cd src/abi && idris2 --check --package boj boj.ipkg"
2425

25-
- name: gateway-exposes-port
26-
description: "Service must expose the configured port."
27-
run: "bash -uc 'ss -lnt | rg \":${GATEWAY_PORT:-8080}\"'"
26+
- name: ffi-builds
27+
description: "Core FFI Zig layer must compile clean."
28+
run: "cd ffi/zig && zig build"
2829

29-
- name: logs-are-json
30-
description: "Logs must be JSON."
31-
run: "bash -uc 'rg --files -g \"*.json\" logs | xargs -r jq -e .'"
30+
- name: ffi-tests-pass
31+
description: "Core FFI tests must pass."
32+
run: "cd ffi/zig && zig build test"
3233

33-
- name: schema-version-matches
34-
description: "Schema must match version spec."
35-
run: "bash -uc 'rg -n \"${SCHEMA_VERSION:-v0.0.1}\" schema'"
34+
- name: cartridge-fleet-abi
35+
description: "Fleet-MCP ABI must type-check."
36+
run: "cd cartridges/fleet-mcp/abi && idris2 --check fleet-mcp.ipkg"
37+
38+
- name: cartridge-nesy-abi
39+
description: "NeSy-MCP ABI must type-check."
40+
run: "cd cartridges/nesy-mcp/abi && idris2 --check nesy-mcp.ipkg"
41+
42+
- name: cartridge-database-abi
43+
description: "Database-MCP ABI must type-check."
44+
run: "cd cartridges/database-mcp/abi && idris2 --check database-mcp.ipkg"
45+
46+
- name: cartridge-agent-abi
47+
description: "Agent-MCP ABI must type-check."
48+
run: "cd cartridges/agent-mcp/abi && idris2 --check agent-mcp.ipkg"
49+
50+
- name: cartridge-ffi-tests
51+
description: "All cartridge FFI tests must pass."
52+
run: |
53+
cd cartridges/fleet-mcp/ffi && zig build test &&
54+
cd ../../nesy-mcp/ffi && zig build test &&
55+
cd ../../database-mcp/ffi && zig build test &&
56+
cd ../../agent-mcp/ffi && zig build test
57+
58+
- name: spdx-headers
59+
description: "All source files must have PMPL-1.0-or-later SPDX headers."
60+
run: "bash -uc 'find src/ ffi/ cartridges/ -name \"*.idr\" -o -name \"*.zig\" | xargs grep -L \"PMPL-1.0-or-later\" | head -5 | { read line && echo \"Missing SPDX: $line\" && exit 1 || true; }'"
61+
62+
- name: menu-exists
63+
description: "A2ML menu must exist."
64+
run: "test -f .machine_readable/servers/menu.a2ml"
65+
66+
- name: order-ticket-exists
67+
description: "Order-ticket protocol spec must exist."
68+
run: "test -f .machine_readable/servers/order-ticket.scm"

0 commit comments

Comments
 (0)