
helm
io.github.zagvar/helm
Rules-based investment risk profiling and portfolio allocation for AI agents.
Documentation
helm
Rules-based investment profiling and portfolio allocation for Node.js services, REST APIs, command-line workflows, and AI agents over MCP.
Helm evaluates applicant answers against a versioned risk model and returns a normalized score, risk profile, portfolio allocation, and definition metadata for auditability. It ships with a default profiling model and supports custom definitions when your questions, scoring, bands, overrides, or allocations need to match a specific policy.
Learn more in the documentation, or try the interactive demo.
This project provides software primitives for investment profiling and allocation. It is not financial advice. Production users remain responsible for regulatory, suitability, audit, and disclosure requirements in their jurisdiction.
Packages
| Package | Purpose |
|---|---|
@zagvar/helm-core | Main engine, default definition, compiler, CSV parser, batch evaluation. |
@zagvar/helm-hono | REST API adapter for Hono services. |
@zagvar/helm-cli | Command-line evaluation, validation, and compilation. |
@zagvar/helm-mcp | MCP server so AI assistants and agents can profile clients. |
@zagvar/helm-types | Shared Zod schemas and TypeScript types. |
Use core when embedding profiling directly in a service, hono when another
system should call the engine over HTTP, cli for local or operational
workflows, mcp when an AI assistant should run the interview, and types
when you only need validation contracts.
Installation
Install only the package or packages your integration needs:
pnpm add @zagvar/helm-core
pnpm add @zagvar/helm-hono hono
pnpm add -D @zagvar/helm-cli
pnpm add @zagvar/helm-mcp
pnpm add @zagvar/helm-types
The workspace targets Node.js >=24.0.0 and pnpm >=11.0.0.
Quick Start
import { RiskProfilerEngine } from "@zagvar/helm-core";
const engine = new RiskProfilerEngine();
try {
const result = await engine.evaluate({
applicantId: "APP-001",
answers: {
investmentHorizonYears: 10,
riskAttitude: "hold",
investmentObjective: "balanced_growth",
annualIncome: 75000,
dtiRatio: 20,
liquidityMonths: 4,
investmentExperience: "intermediate",
},
});
console.log(result.profile.label);
console.log(result.normalizedScore);
console.log(result.allocation);
} finally {
engine.dispose();
}
Call engine.dispose() when the engine is no longer needed so the underlying
ZenEngine resources are released.
The default model includes seven scored factors, five risk profiles, four asset classes, and an override that assigns a conservative profile when debt-to-income ratio is high. See Model Concepts for the full model details.
Common Workflows
Core Engine
Use RiskProfilerEngine for direct evaluation from a Node.js service. It
supports single-applicant evaluation, ordered batch evaluation, CSV batch
parsing, default definitions, and custom definitions.
See the core guide.
REST API
Mount the Hono adapter when another service should call Helm over HTTP:
import { serve } from "@hono/node-server";
import { createRiskProfilerService } from "@zagvar/helm-hono";
const service = createRiskProfilerService();
serve({
fetch: service.app.fetch,
port: 3000,
});
The adapter exposes health, definition, questions, validation, single evaluation, JSON batch, and CSV batch endpoints.
See the REST API guide and endpoint reference.
CLI
Use the CLI for local evaluation, CSV workflows, definition compilation, and JDM graph validation:
pnpm add --save-dev @zagvar/helm-cli
pnpm exec zagvar-helm --help
pnpm exec zagvar-helm evaluate --input input.json --output json
pnpm exec zagvar-helm evaluate-batch --input applicants.csv --input-format csv --output csv
pnpm exec zagvar-helm compile --definition definition.json --output graph.jdm.json
pnpm exec zagvar-helm validate --jdm graph.jdm.json --definition definition.json
See the CLI guide and CLI reference.
MCP Server
Run Helm as an MCP server so an AI assistant can interview a client and get a
deterministic profile back. For Claude Desktop, add this to
claude_desktop_config.json:
{
"mcpServers": {
"helm": {
"command": "npx",
"args": ["-y", "@zagvar/helm-mcp"]
}
}
}
The server exposes get_questionnaire, evaluate_risk_profile, and
describe_risk_model tools plus a risk_profile_interview prompt.
See the MCP server guide and the package README.
Custom Definitions
Helm is definition-driven. A definition controls questions, scoring, profiles, score bands, overrides, asset classes, and allocations. Expert users can also supply custom JDM graphs when they follow the Helm input and result contract.
See the custom definitions guide, definition schema reference, and expert JDM contract.
Development
pnpm install
pnpm typecheck
pnpm lint
pnpm test
pnpm build
Useful docs commands:
pnpm docs:dev
pnpm docs:build
The workspace uses pnpm workspaces, TypeScript project references, tsdown, Vitest, ESLint, and a Next.js docs app.
Releasing
Releases are automated with Changesets
and the Release workflow:
- In any PR that changes a published package, run
pnpm changesetand commit the generated file. It records which packages change and how (patch, minor or major), plus a line for the changelog. - When that PR merges, the workflow opens or updates a Version Packages
PR that bumps versions, writes changelogs and syncs the MCP
server.json. - Merging the Version Packages PR publishes the new versions to npm with
trusted publishing (no npm token), creates GitHub releases, mirrors the
packages to GitHub Packages and, when
@zagvar/helm-mcpchanges, publishes it to the MCP Registry.
License
MIT - see LICENSE.
@zagvar/helm-mcpnpm install @zagvar/helm-mcp