Skip to content

Commit 769e19c

Browse files
hyperpolymathclaude
andcommitted
feat(ux): add onboarding, contractiles, and UX infrastructure
- Purge hardcoded absolute paths (replaced with env vars / relative) - Add QUICKSTART-USER.adoc with real build/run instructions - Add doctor/heal/tour/help-me recipes to Justfile - Add LLM warmup scripts (user + dev, token-efficient) - Add contractile baselines: MUST, TRUST, INTENT, ADJUST - Add guix.scm + flake.nix for reproducible environments - Slim/create AI manifest with tiered context loading Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 685117f commit 769e19c

19 files changed

Lines changed: 1394 additions & 241 deletions

.gitleaksignore

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
# SPDX-License-Identifier: PMPL-1.0-or-later
33

44
# Skip known test placeholders in Zig FFI tests
5-
/var/mnt/eclipse/repos/boj-server/cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1068
6-
/var/mnt/eclipse/repos/boj-server/cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1095
7-
/var/mnt/eclipse/repos/boj-server/cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1129
8-
/var/mnt/eclipse/repos/boj-server/cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1176
9-
/var/mnt/eclipse/repos/boj-server/cartridges/research-mcp/ffi/research_ffi.zig:generic-api-key:391
5+
cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1068
6+
cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1095
7+
cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1129
8+
cartridges/cloud-mcp/ffi/cloud_ffi.zig:generic-api-key:1176
9+
cartridges/research-mcp/ffi/research_ffi.zig:generic-api-key:391
Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
; SPDX-License-Identifier: PMPL-1.0-or-later
2+
; ADJUST.contractile — Accessibility invariants for boj-server
3+
; "ADJUST" = Accessibility & Digital Justice for Universal Software & Technology
4+
;
5+
; Part of the contractile family: MUST, TRUST, DUST, INTENT, ADJUST
6+
; This file is machine-readable. LLM/SLM agents MUST NOT violate these invariants.
7+
8+
; ── Definitions ──────────────────────────────────────────────────
9+
;
10+
; ADJUST (noun/verb)
11+
; The accessibility contractile. Defines how software must adapt to serve
12+
; all users regardless of ability, device, or context. Named for the verb
13+
; "adjust" — to make suitable, to adapt, to accommodate — which is the
14+
; core action of accessible design.
15+
;
16+
; Scope:
17+
; ADJUST governs all user-facing interfaces: GUI, TUI, CLI, web, mobile,
18+
; documentation, error messages, and installation flows. It applies to
19+
; both human users and assistive technologies (screen readers, switch
20+
; devices, braille displays, voice control).
21+
;
22+
; Relationship to other contractiles:
23+
; - MUST: ADJUST invariants are a subset of MUST — violating ADJUST
24+
; is a MUST violation. ADJUST exists separately because accessibility
25+
; rules are numerous enough to warrant their own file, and because
26+
; LLMs frequently forget accessibility unless explicitly reminded.
27+
; - TRUST: ADJUST does not affect trust levels. All trust tiers must
28+
; respect ADJUST invariants equally.
29+
; - DUST: Deprecating a feature does not exempt it from ADJUST until
30+
; it is fully removed. Deprecated UI must remain accessible.
31+
; - INTENT: ADJUST supports the anti-purpose "this software is NOT
32+
; only for able-bodied users with modern hardware."
33+
;
34+
; Standard: WCAG 2.2 Level AA (minimum)
35+
; https://www.w3.org/WAI/WCAG22/quickref/?levels=aaa
36+
;
37+
; Why a separate file:
38+
; Experience shows LLMs and developers alike treat accessibility as an
39+
; afterthought. By placing invariants in a contractile that is loaded
40+
; at session start, we make it structurally impossible to forget.
41+
;
42+
; ── End Definitions ──────────────────────────────────────────────
43+
44+
(adjust-contractile
45+
(version "1.0.0")
46+
(full-name "Accessibility & Digital Justice for Universal Software & Technology")
47+
(standard "WCAG-2.2-AA")
48+
(repo "boj-server")
49+
50+
(invariants
51+
; ── Visual ──
52+
(adjust "colour-contrast-ratio >= 4.5:1 for normal text")
53+
(adjust "colour-contrast-ratio >= 3:1 for large text (18pt+ or 14pt+ bold)")
54+
(adjust "no information conveyed by colour alone")
55+
(adjust "no flashing or strobing content (3 flashes/second max)")
56+
(adjust "text resizable to 200% without loss of content or function")
57+
(adjust "focus indicators visible on all interactive elements")
58+
59+
; ── Keyboard ──
60+
(adjust "all interactive elements reachable via keyboard (Tab/Shift+Tab)")
61+
(adjust "no keyboard traps — user can always Tab away")
62+
(adjust "skip navigation link present on pages with repeated blocks")
63+
(adjust "logical focus order follows visual reading order")
64+
65+
; ── Screen reader ──
66+
(adjust "all images have meaningful alt text (or alt='' if decorative)")
67+
(adjust "all form inputs have associated labels")
68+
(adjust "ARIA landmarks used for page regions (main, nav, banner, etc.)")
69+
(adjust "dynamic content updates announced via aria-live regions")
70+
(adjust "semantic HTML used (headings, lists, tables) — not div soup")
71+
72+
; ── Interactive ──
73+
(adjust "touch targets minimum 44x44px on mobile/touch interfaces")
74+
(adjust "error messages identify the field and describe the error")
75+
(adjust "error messages not conveyed by colour or position alone")
76+
(adjust "form validation provides suggestions for correction")
77+
78+
; ── Media ──
79+
(adjust "video has captions (closed or open)")
80+
(adjust "audio-only content has text transcript")
81+
(adjust "no autoplay of media with sound")
82+
83+
; ── Motion ──
84+
(adjust "animations respect prefers-reduced-motion media query")
85+
(adjust "no content depends on motion to convey meaning")
86+
87+
; ── CLI/TUI ──
88+
(adjust "CLI output must not rely solely on colour (use symbols: [OK] [FAIL])")
89+
(adjust "TUI must support high-contrast mode")
90+
(adjust "all CLI commands support --help with plain-text output")
91+
(adjust "error messages written in plain language, not jargon or codes alone")
92+
93+
; ── Documentation ──
94+
(adjust "docs use clear language, short sentences, logical structure")
95+
(adjust "code examples include comments explaining non-obvious steps")
96+
(adjust "diagrams have text descriptions or alt text")
97+
)
98+
99+
(enforcement
100+
(ci "accessibility linting in quality.yml workflow")
101+
(pr-block "PR blocked if accessibility regression detected")
102+
(tool "axe-core or pa11y for automated checks on web UI")
103+
(tool "CLI output inspected for colour-only signalling")
104+
(manual "manual screen reader test before major releases")
105+
)
106+
107+
(notes
108+
"These are MINIMUM requirements. Exceeding them (AAA) is encouraged."
109+
"When in doubt about an accessibility decision, ask — don't guess."
110+
"Accessibility is not optional polish — it is a structural requirement."
111+
)
112+
)
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
; SPDX-License-Identifier: PMPL-1.0-or-later
2+
; INTENT.contractile — Purpose and scope for boj-server
3+
; Helps LLM/SLM agents understand what this repo IS and IS NOT.
4+
5+
(intent-contractile
6+
(version "1.0.0")
7+
(repo "boj-server")
8+
9+
; === Purpose (what this repo IS) ===
10+
(purpose
11+
"BoJ (Bureau of Justice) is a unified MCP server that consolidates all hyperpolymath
12+
tooling into a single endpoint. It provides Claude Code integration for GitHub,
13+
GitLab, Cloudflare, Vercel, Verpex, Gmail, Calendar, browser automation, research,
14+
ML, and 50+ open-source cartridges. It implements a three-class architecture:
15+
Class 1 (Simple Track) for zero-infrastructure CLI/curl workflows, Class 2
16+
(Orchestrator Track) for HMAC-SHA256 webhooks and real-time MQTT/WS, and Class 3
17+
(Multiplier Track) for Elixir/BEAM mass concurrency."
18+
)
19+
20+
; === Anti-Purpose (what this repo is NOT — prevents scope creep) ===
21+
(anti-purpose
22+
"BoJ is NOT a general-purpose API gateway or reverse proxy. It is NOT a standalone
23+
application — it serves LLM/MCP tool consumers. It does NOT implement business logic
24+
for the services it connects to (GitHub, GitLab, etc.) — it provides typed adapters.
25+
It is NOT a replacement for direct API access when MCP is not involved. All MCP goes
26+
through BoJ — no standalone MCP servers are permitted in the ecosystem."
27+
)
28+
29+
; === Key Architectural Decisions That Must Not Be Reversed ===
30+
(architectural-invariants
31+
"Three-class architecture: Simple (Class 1) must never be broken by Class 2/3"
32+
"MCP bridge as sole entry point for Claude Code integration"
33+
"REST API on port 7700 for all cartridge invocations"
34+
"Self-contained cartridges with own adapters in cartridges/<name>/adapter/"
35+
"All MCP through BoJ only — no standalone MCP servers"
36+
"Firefox first for browser automation — not Chrome"
37+
"HMAC-SHA256 webhook verification for Class 2 orchestrator track"
38+
)
39+
40+
; === Sensitive Areas (if in doubt, ask) ===
41+
(ask-before-touching
42+
"mcp-bridge/ — MCP protocol bridge; changes affect all Claude Code integration"
43+
"adapter/ — service adapters (GitHub, GitLab, Cloudflare, etc.); API contract changes"
44+
"cartridges/ — self-contained service cartridges; each has own adapter"
45+
"ffi/ — foreign function interface layer"
46+
".machine_readable/ — checkpoint files, format is specified"
47+
"ai-plugin.json — cartridge metadata; must remain valid for discovery"
48+
)
49+
50+
; === Ecosystem Position ===
51+
(ecosystem
52+
(belongs-to "standalone")
53+
(depends-on ("github-api" "gitlab-api" "cloudflare-api" "vercel-api" "verpex-api"))
54+
(depended-on-by ("claude-code" "panll" "hypatia" "ambientops"))
55+
)
56+
)

.machine_readable/MUST.contractile

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
; SPDX-License-Identifier: PMPL-1.0-or-later
2+
; MUST.contractile — Baseline invariants for boj-server
3+
; These constraints MUST NOT be violated. K9 validators enforce them.
4+
5+
(must-contractile
6+
(version "1.0.0")
7+
(repo "boj-server")
8+
9+
; === Universal Invariants (apply to ALL repos) ===
10+
11+
(invariants
12+
; Paths
13+
(must "no hardcoded absolute paths (/home/*, /mnt/*, /var/mnt/*)")
14+
(must "all paths use env vars, XDG dirs, or relative references")
15+
16+
; Language policy
17+
(must "no new TypeScript files")
18+
(must "no new Python files")
19+
(must "no new Go files")
20+
(must "no npm/bun/yarn/pnpm dependencies — Deno only")
21+
22+
; Dangerous patterns
23+
(must "no believe_me (Idris2)")
24+
(must "no assert_total (Idris2)")
25+
(must "no Admitted (Coq)")
26+
(must "no sorry (Lean)")
27+
(must "no unsafeCoerce (Haskell)")
28+
(must "no Obj.magic (OCaml)")
29+
(must "no unsafe {} blocks without safety comment (Rust)")
30+
31+
; License
32+
(must "SPDX-License-Identifier header on every source file")
33+
(must "no removal or modification of LICENSE file")
34+
35+
; Structure
36+
(must ".machine_readable/ directory preserved")
37+
(must "0-AI-MANIFEST.a2ml preserved")
38+
(must "no SCM files in repo root — only in .machine_readable/")
39+
40+
; CI
41+
(must "no removal of CI workflows without explicit approval")
42+
(must "all GitHub Actions SHA-pinned")
43+
44+
; Code quality
45+
(must "tests must not be deleted or weakened")
46+
(must "generated code in generated/ directory only")
47+
(must "no introduction of OWASP top 10 vulnerabilities")
48+
49+
; ABI/FFI (if applicable)
50+
(must "no modification of ABI contracts without proof update")
51+
(must "no removal of formal verification proofs")
52+
)
53+
54+
; === Project-Specific Invariants (boj-server) ===
55+
56+
(invariants
57+
; Three-class architecture
58+
(must "Class 1 Simple Track must never be damaged or replaced by Class 2/3 features")
59+
(must "three-class architecture (Simple, Orchestrator, Multiplier) must be maintained")
60+
61+
; MCP protocol
62+
(must "MCP bridge must remain the sole entry point for Claude Code integration")
63+
(must "REST API on port 7700 must remain operational for all cartridge invocations")
64+
(must "all MCP tools must go through BoJ — no standalone MCP servers")
65+
66+
; Cartridge system
67+
(must "cartridge self-containment — each cartridge has own adapter in cartridges/<name>/adapter/")
68+
(must "cartridge metadata (ai-plugin.json) must remain valid")
69+
(must "no removal of existing cartridges without explicit approval")
70+
71+
; Security
72+
(must "HMAC-SHA256 webhook verification for Class 2 orchestrator track")
73+
(must "API keys and tokens must never be committed — use environment variables")
74+
(must "host_permissions in browser extensions must be localhost only")
75+
76+
; Integrations
77+
(must "GitHub, GitLab, Cloudflare, Vercel, Verpex, Gmail, Calendar adapters must remain functional")
78+
(must "browser automation capabilities must not be removed")
79+
)
80+
81+
(enforcement
82+
(k9-validator "contractiles/k9/must-check.k9.ncl")
83+
(ci "quality.yml runs must-check on every PR")
84+
)
85+
)
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
; SPDX-License-Identifier: PMPL-1.0-or-later
2+
; TRUST.contractile — Trust boundaries for boj-server
3+
; Defines what LLM/SLM agents are trusted to do without asking.
4+
5+
(trust-contractile
6+
(version "1.0.0")
7+
(repo "boj-server")
8+
9+
(trust-level "maximal") ; maximal | standard | restricted | minimal
10+
11+
; === Maximal Trust (default) ===
12+
; LLM may freely do these without asking:
13+
(trust-actions
14+
"read" ; Read any file in the repo
15+
"build" ; Run build commands
16+
"test" ; Run test suites
17+
"lint" ; Run linters and formatters
18+
"format" ; Auto-format code
19+
"doctor" ; Run self-diagnostics
20+
"heal" ; Attempt automatic repair
21+
"git-status" ; Check git status
22+
"git-diff" ; View diffs
23+
"git-log" ; View history
24+
)
25+
26+
; === Denied Actions (always require human approval) ===
27+
(trust-deny
28+
"delete-branch" ; Could lose work
29+
"force-push" ; Overwrites history
30+
"modify-ci-secrets" ; Security sensitive
31+
"publish" ; External visibility
32+
"push-to-main" ; Protected branch
33+
"delete-files-bulk" ; More than 5 files at once
34+
"modify-license" ; Legal implications
35+
"modify-security-policy" ; Security implications
36+
"remove-proofs" ; Formal verification regression
37+
"disable-ci-checks" ; Safety regression
38+
"remove-cartridge" ; Deleting an existing cartridge
39+
"modify-api-keys" ; Changing token/key configuration
40+
"modify-mcp-bridge" ; Altering the MCP protocol bridge
41+
)
42+
43+
; === Trust Boundary ===
44+
(trust-boundary "repo") ; LLM confined to this repo unless explicitly told otherwise
45+
)
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
// SPDX-License-Identifier: PMPL-1.0-or-later
2+
// Copyright (c) 2026 Jonathan D.A. Jewell (hyperpolymath) <j.d.a.jewell@open.ac.uk>
3+
= Agent Instructions
4+
:toc: preamble
5+
6+
Methodology-aware configuration for AI agents. Read by any AI agent
7+
(Claude, Gemini, Copilot, etc.) at session start.
8+
9+
== Files
10+
11+
[cols="1,3"]
12+
|===
13+
| File | Purpose
14+
15+
| `methodology.a2ml`
16+
| Default mode, invariants, ring ceiling, priority weights, convergent budget
17+
18+
| `coverage.a2ml`
19+
| Session coverage tracking — what was visited, what was skipped, what has MUSTs
20+
21+
| `debt.a2ml`
22+
| Meander debt — things found but not fixed, carried between sessions
23+
|===
24+
25+
== How Agents Use These
26+
27+
1. Read `methodology.a2ml` at session start — know mode, invariants, ceiling
28+
2. Read `coverage.a2ml` — know what was visited last time, what was skipped
29+
3. Read `debt.a2ml` — know what's outstanding from previous sessions
30+
4. At session end, update `coverage.a2ml` and `debt.a2ml`
31+
32+
== Relationship to Other Files
33+
34+
* `AGENTIC.a2ml` says WHAT agents can do (permissions, gating)
35+
* `agent_instructions/` says HOW agents should work (methodology)
36+
* `bot_directives/` says what the gitbot-fleet does (fleet-specific)
37+
* `CLAUDE.md` says how Claude specifically should work (Claude-specific)
38+
39+
== Reference
40+
41+
ADR-002 in `standards/agentic-a2ml/docs/ADR-002-methodology-layer.adoc`

0 commit comments

Comments
 (0)