AxiomEngine is a Go microservice that generates personalized, prerequisite-ordered adaptive study plans from student assessment deficits. It combines an in-memory curriculum knowledge graph with inference executed through a configurable model provider (defaulting to Amazon Bedrock, with support for OpenAI, Anthropic, Google AI, Ollama, and generic OpenAI-compatible endpoints) via a generated BAML client. The service exposes HTTP endpoints for study plan generation, real-time Server-Sent Events (SSE) streaming, cognitive shadow graph visualization, curriculum topic queries, and system health probes, as well as a Model Context Protocol (MCP) server over standard input and output (axiom-server mcp) exposing reasoning and curriculum tools.
Knowledge-graph guided reasoning: Extracts prerequisite chains and local subgraphs using depth-first and breadth-first search over an immutable graph.
Configurable model providers: Routes reasoning prompts through Amazon Bedrock (aws-bedrock, default), OpenAI (openai), Anthropic (anthropic), Google AI (google-ai), Ollama (ollama), or OpenAI-compatible endpoints (openai-generic) via BAML.
VARK-aligned resource mapping: Generates study recommendations tailored to visual, auditory, read-write, or kinesthetic learning modalities.
Concurrent bounded fan-out: Dispatches parallel per-topic model calls bounded per request and by a process-wide concurrency limit, protected by circuit breaking.
Adaptive plan streaming: Streams concept generation progress and completed plans in real time over Server-Sent Events (SSE), cancelling downstream reasoning if the client disconnects.
Idempotent plan generation: Replays stored responses for repeated requests carrying an Idempotency-Key header without repeating model inference.
Shared Redis storage: Shares sliding-window rate limit budgets and plan idempotency records across service replicas when REDIS_URL is configured.
Curriculum topic listing: Exposes endpoints to inspect curriculum topics and retrieve full study-ordered prerequisite chains without model provider calls.
Learner mastery filtering: Incorporates known mastered concepts into requests to omit mastered prerequisites from recommendations while preserving complete prerequisite chains.
Cognitive shadow graphs: Computes graph neighborhoods classifying concepts into failed, learning, mastered, and unassessed states for frontend visualization.
Model Context Protocol (MCP): Runs as an MCP server over standard input and output (axiom-server mcp), exposing reasoning and curriculum tools to MCP-compatible clients.
Distributed tracing: Exports OpenTelemetry traces over OTLP/HTTP to generic collectors or LangSmith, supporting span hierarchy correlation and optional prompt and completion content capture.
Hallucination validation: Verifies model outputs against known graph nodes, dropping unrecognized concepts and concepts outside the requested topics and their prerequisites before assigning priorities.
Configurable token authentication: Restricts API access using constant-time verification of internal shared tokens, supporting zero-downtime secret rotation.
Optional resource link validation: Verifies recommended resource URLs with outbound HEAD and GET checks and SSRF protections when enabled (RESOURCE_LINK_CHECK=true), dropping unreachable links.
Request Path
Installation
Container Image
Multi-architecture container images (linux/amd64 and linux/arm64) are published to GitHub Packages at ghcr.io/victoroide/axiom-engine.
Published releases include the following tag formats:
Full release tag: ghcr.io/victoroide/axiom-engine:v1.2.3
Semantic version tag: ghcr.io/victoroide/axiom-engine:1.2.3
Minor version tag: ghcr.io/victoroide/axiom-engine:1.2
Standalone native executable archives are attached to GitHub releases for linux/amd64, linux/arm64, and darwin/arm64. Each archive contains the stripped axiom-server binary, the verified native BAML CFFI shared library under its upstream filename (libbaml_cffi-x86_64-unknown-linux-gnu.so, libbaml_cffi-aarch64-unknown-linux-gnu.so, or libbaml_cffi-aarch64-apple-darwin.dylib), LICENSE, and README.md. To run an extracted archive, set BAML_LIBRARY_PATH to the bundled native library; see Run an archive for instructions.
Each release attaches:
axiom-engine_<version>_<os>_<arch>.tar.gz (where <version> omits the leading v, for example axiom-engine_1.2.3_linux_amd64.tar.gz)
checksums.txt (SHA-256 digests of all platform archives)
For Cosign provenance verification instructions, see docs/deployment.md.
Building from Source
Build requirements: Go 1.27.3, a C compiler toolchain (gcc or clang) with CGO enabled.
Clone the repository and download Go dependencies:
git clone https://github.com/Victoroide/axiom-engine.git
cd axiom-engine
go mod download
Download and verify the native BAML CFFI library for your platform:
make native-baml
Compile the service binary:
make build
The compiled binary is written to bin/axiom-server.
Quick Start
Docker Compose
Copy the example environment file:
cp .env.example .env
Generate an internal token and set AXIOM_INTERNAL_TOKEN=<generated value> in .env:
openssl rand -hex 32
Configure credentials for your selected model provider in .env. For the default aws-bedrock provider, set AWS_REGION, AWS_ACCESS_KEY_ID, and AWS_SECRET_ACCESS_KEY. For other providers, set LLM_PROVIDER, LLM_MODEL, and the corresponding provider API key (such as OPENAI_API_KEY).
Build and start the container with Docker Compose:
docker compose up --build
The container runs as non-root UID/GID 65532:65532 and binds port 8080 to loopback (http://127.0.0.1:8080).
Local Development
Prerequisites: Go 1.27.3, CGO toolchain, and provider credentials.
Set the required provider credentials and service token:
Running ./bin/axiom-server directly requires BAML_LIBRARY_PATH and BAML_LIBRARY_DISABLE_DOWNLOAD=true. Prefer make run.
The server listens on :8080 (http://0.0.0.0:8080). When SWAGGER_ENABLED=true (the default), interactive documentation is available at http://127.0.0.1:8080/swagger/index.html.
Configuration Summary
The service is configured using environment variables. The table below lists the most important variables and their default values:
Variable
Default
Description
PORT
8080
TCP port on which the HTTP server listens.
AXIOM_INTERNAL_TOKEN
"" (unset)
Shared secret required in X-Internal-Token or Authorization: Bearer on /api/v1/* routes. Required in HTTP mode unless AXIOM_AUTH_DISABLED=true.
AXIOM_INTERNAL_TOKEN_PREVIOUS
"" (unset)
Previous secret accepted during zero-downtime token rotation.
AXIOM_AUTH_DISABLED
false
When true, disables token authentication on /api/v1/* routes.
LLM_PROVIDER
aws-bedrock
Model provider: aws-bedrock, openai, anthropic, google-ai, ollama, or openai-generic.
LLM_MODEL
amazon.nova-micro-v1:0 (aws-bedrock)
Model identifier passed to the provider. Required for providers other than aws-bedrock.
LLM_BASE_URL
"" (http://localhost:11434/v1 for ollama)
Custom API base URL for openai, ollama, or openai-generic. Required for openai-generic.
REQUEST_TIMEOUT
20s
Maximum deadline for servicing incoming HTTP reasoning requests.
LLM_TIMEOUT
15s
Timeout applied to each individual per-topic model call.
LLM_MAX_CONCURRENCY
16
Maximum simultaneous in-flight provider calls across the process.
RATE_LIMIT_MAX
50
Maximum requests allowed from a client IP within RATE_LIMIT_WINDOW.
RATE_LIMIT_WINDOW
1m
Sliding window duration for IP rate limiting.
REDIS_URL
"" (unset)
Optional Redis URL for shared rate limiting and plan idempotency across replicas.
IDEMPOTENCY_TTL
24h
Retention duration for idempotent study plan replay responses (0s disables).
RESOURCE_LINK_CHECK
false
When true, verifies recommended resource URLs with outbound HTTP checks before returning plans.
TRACING_ENABLED
false
When true, exports OpenTelemetry traces over OTLP/HTTP to an external collector.
LANGSMITH_TRACING
false
When true, exports model traces to LangSmith (requires LANGSMITH_API_KEY).
METRICS_ENABLED
false
When true, serves Prometheus metrics at GET /metrics without authentication.
SWAGGER_ENABLED
true
When true, serves Swagger UI and OpenAPI documentation at /swagger/*.
Generate a personalized study plan for failed concepts. Supplying an Idempotency-Key header allows safe retries; subsequent requests with the same key and payload replay the cached response (Idempotent-Replayed: true) without repeating model inference.
Stream plan generation progress in real time over Server-Sent Events (SSE). Emits topic events as each concept plan completes, followed by a final validated plan or error event:
The server sends periodic : keepalive comments every 2 seconds. If a client disconnects prematurely, in-flight topic reasoning is cancelled immediately to release concurrency slots and avoid unnecessary token consumption.
Curriculum Topics
List curriculum concepts with direct prerequisites and dependents:
Prompt and completion content capture on trace spans is controlled by TRACING_CAPTURE_CONTENT (defaults to true when LangSmith is enabled, false otherwise).
In-Memory Rate Limiting: When REDIS_URL is unset, rate limiting operates per replica in memory, keyed by client IP (masked to /64 for IPv6). Setting REDIS_URL shares rate-limit budgets and plan idempotency records across all replicas. For multi-tenant platform limits and per-tenant quotas, gateway enforcement remains recommended.
Client Disconnects on Non-Streaming Requests: On the non-streaming route (POST /api/v1/adaptive-plan), client HTTP disconnects do not cancel in-flight model reasoning; execution continues until REQUEST_TIMEOUT expires. The streaming route (POST /api/v1/adaptive-plan/stream) detects client disconnects through two-second keepalives and cancels in-flight reasoning promptly.
Single Shared Secret: Authentication relies on a single shared secret without caller identity or per-tenant authorization. Fine-grained authorization, per-caller rate limiting, and multi-tenant isolation belong at the platform or gateway tier.
Native Library Initialization: The BAML CFFI dynamic library is loaded during package initialization before main executes; missing or mismatched libraries panic directly to stderr in plain text prior to structured JSON logger initialization.
Bedrock Region Resolution and Caching: When using LLM_PROVIDER=aws-bedrock, AWS regions resolved dynamically from IMDS cannot be confirmed at startup, and the first resolved region is cached by BAML for the lifetime of the process. Non-Bedrock providers do not perform region resolution.
Resource Link Reachability: Recommended resource URLs are not checked for network reachability by default. Setting RESOURCE_LINK_CHECK=true enables outbound HTTP reachability checks that verify URLs and drop non-resolving or refused resources before returning plans.
In-Memory Knowledge Graph Immutability: The curriculum knowledge graph is loaded into memory at startup from embedded data or GRAPH_FILE and cannot be modified dynamically at runtime without restarting the service process.
MCP Transport Scope: The Model Context Protocol server currently implements standard input and output (stdio) transport exclusively; remote transports such as HTTP Server-Sent Events (SSE) or WebSocket are not supported.
Scorecard Governance: Repository OpenSSF Scorecard branch protection scores reflect a single-maintainer project with zero required external approvals.
For diagnostic procedures and operational troubleshooting, refer to the Operations Runbook.
Roadmap
Cancellation propagation for non-streaming HTTP requests when clients disconnect.
Per-tenant authentication and caller identity verification.
Dynamic curriculum knowledge graph updates without service restarts.
Remote transport support for the Model Context Protocol server.
Fine-grained per-tenant rate limit quotas in shared storage.
Diagnostic runbooks for open breakers, throttling, credential errors, native library panics, and production metrics
Contributing and Support
For contribution guidelines and coding standards, refer to CONTRIBUTING.md.
For support requests, bug reports, and general questions, refer to SUPPORT.md.
For security policy and vulnerability disclosures, refer to SECURITY.md.
For community standards, refer to CODE_OF_CONDUCT.md.
For release history, see CHANGELOG.md.
Citation
To cite AxiomEngine in publications or research metadata, see CITATION.cff.
Acknowledgements
AxiomEngine is built on open-source libraries and systems: