@burtson-labs/host-kit
v0.4.0
Published
Host-agnostic building blocks for the Bandit agent framework — memory files, hooks, mentions, and the extra tool set (todo_write, web_fetch).
Readme
@burtson-labs/host-kit
Host-agnostic building blocks shared between the Bandit CLI and the VS Code extension.
Writing a new host (a Cursor sidebar, a JetBrains plugin, a custom CLI)? Pull from here.
Install
pnpm add @burtson-labs/host-kitWhat's in the box
- Memory loader — discovers and merges
BANDIT.md/CLAUDE.md/AGENTS.mdfiles across workspace + global locations; deduplicates overlapping content at load time;consolidateMemory()unifies multiple entry files into a single canonicalBANDIT.md(symlink on macOS/Linux, copy-with-drift-warning on Windows) - Topic memory — lazy-load index at
.bandit/memory/MEMORY.md(preferred) with back-compat reads from legacy rootMEMORY.md; writes always go to.bandit/memory/;migrateMemoryToBanditDir()moves an existing rootmemory/layout into.bandit/memory/idempotently @-mentionexpansion — detects@path/to/filein user input and inlines file contents (with secret redaction) or attaches images as base64- Hook runner — executes PreToolUse / PostToolUse / Stop / UserPromptSubmit hooks;
loadHookSettingsmerges the global~/.bandit/settings.jsonunder the workspace.bandit/settings.jsonso hooks + permissions + the guard apply across every repo - Pre-tool security guard —
evaluateSecurityGuard(call, settings, ctx): an opt-in, in-process safety net (no shell spawn) that blocks catastrophic tool calls (rm -rf /,curl … | sh, disk wipes, credential exfil, writes to system/credential paths) before they run. Wired intobeforeToolExecutein both hosts - MCP loader — reads
mcp-servers.json(global + workspace, workspace wins), auto-injectsBANDIT_API_KEY, registers servers with the pool - Turn trace reader — parses workspace and global
.bandit/turns/*.jsonlinto summaries and markdown timelines for CLI/trace, IDE/trace, tests, and future bug-bundle export - Insights — usage analytics aggregator (CLI sessions → human report)
- Extra tool builders —
todo_write,web_fetch,web_search,task(subagent),remember,test_run,pdf_read
Status
Stable. Imported by both apps/bandit-cli/ and apps/bandit-stealth/ — breaking changes here require coordinated PRs to both hosts.
Quick example
import { loadMemory, expandMentions, registerMcpServersFromDisk } from '@burtson-labs/host-kit';
const memory = await loadMemory(workspaceCwd);
const { prompt, images } = await expandMentions(rawUserInput, workspaceCwd);
const count = await registerMcpServersFromDisk(workspaceCwd, mcpPool);Tests
pnpm --filter @burtson-labs/host-kit testLicense
Apache License 2.0 — Copyright 2026 Burtson Labs.
