@arnilo/prism
v0.14.3
Published
Agent harness for AI providers, agents, sessions, and tools.
Maintainers
Readme
prism
Prism is a TypeScript SDK for running AI agents on Bun. @arnilo/prism is a small kernel: the agent loop, tools and skills, hooks, slots, and a package loader. Everything else (model vendors, coding tools, web search, memory, storage, policy) is a package you choose to install. PRODUCT.md explains the design.
Install
bun add @arnilo/prismAdd the packages your agent needs. Each one is optional and activates only when you list it in createAgent:
bun add @arnilo/prism-ai @arnilo/prism-tools @arnilo/prism-extensionsQuick start
An agent is a model plus the packages you list. This one talks to Hyper and can read and edit files under the current directory. The provider reads HYPER_API_KEY from the environment; Prism never stores or logs it.
import { createAgent } from "@arnilo/prism";
import hyper from "@arnilo/prism-ai/hyper";
import approval from "@arnilo/prism-extensions/approval";
import coding from "@arnilo/prism-tools/coding";
const agent = await createAgent({
model: "hyper/claude-sonnet-4-5",
packages: [hyper({ apiKey: "env:HYPER_API_KEY" }), coding({ root: process.cwd() }), approval({ mode: "edits" })],
});
const session = await agent.session();
for await (const event of session.stream("List the files here")) {
if (event.type === "message.delta" && event.content.type === "text") process.stdout.write(event.content.text);
}
await agent.dispose();approval({ mode: "edits" }) lets reads and edits inside the root through and asks before anything else, such as a shell command. Without a policy package, coding runs shell on the host only after asking through host.ui for each command, and a run with no UI suspends at the first one; a sandbox (coding({ root, sandbox: "native" })) or guard: "off" changes that.
Run it with bun run agent.ts. To try it offline, import mockProvider from @arnilo/prism/testing, list mockProvider([[{ type: "content_delta", content: { type: "text", text: "Hello" } }, { type: "done" }]]) in packages instead of the provider and tool packages, and set model: "mock/demo".
session.stream yields the events of one run; docs/events.md lists them. agent.inspect() shows every package, tool, and hook that loaded.
Write a package
A package is a plain TypeScript module that Bun runs as-is. It receives the SDK's API when it loads and changes the agent through it:
import { definePackage } from "@arnilo/prism";
export default definePackage({
name: "@acme/prism-audit",
version: "1.0.0",
requires: { api: 1 },
setup(prism) {
prism.hooks.on("tool.call", (call) => (call.name === "shell" ? { deny: "blocked by audit policy" } : undefined));
},
});Pass it to createAgent({ packages: [...] }) next to the others. docs/packages.md covers config, services, slots, and the manifest.
Where next
- docs/index.md is the map of every kernel page, package README, and guide.
- examples/README.md is the examples gallery.
- apps/prism-agent/README.md walks through the reference host, a coding agent built only on
@arnilo/prismand the manifest. - packages/hosts/host-builder/README.md helps a coding agent, including a Prism agent, build a host against the installed version: version-exact indexes, a skill, an MCP server, an installer, and
examples/host-builder-agent.ts.
Packages
7 publishable manifests — root @arnilo/prism plus 6 workspace packages (0 prism-* family packages, 6 capability packages). Generated by bun scripts/package-truth.mjs --emit-docs — do not hand-edit.
| package | version | notes |
| --- | --- | --- |
| @arnilo/prism | 0.14.3 | core — runtime, CLI/RPC, templates, docs |
| @arnilo/prism-ai | 0.14.1 | capability |
| @arnilo/prism-extensions | 0.14.1 | capability |
| @arnilo/prism-hosts | 0.14.3 | library bundle — host protocols, channels, evaluations, devtools, headless routing, process driver and version-exact host-builder kit |
| @arnilo/prism-knowledge | 0.14.0-experimental.1 | capability — experimental knowledge bundle: wiki and RAG subpaths; depends on the memory-system range |
| @arnilo/prism-memory-system | 0.14.1 | capability — the memory system: session memory (STM) that observes the session, keeps a source-backed ledger, and compacts from it when the host turns it on; experimental WM, rehearsal and long-term memory (ltm), the store of record behind the memory.* tools |
| @arnilo/prism-tools | 0.14.0 | capability |
Memory. @arnilo/prism-memory-system is stable: its session memory is the recommended compaction system (enabled: true), with @arnilo/prism-extensions/compaction as the alternative. Its working memory, long-term memory and the rest are experimental config. @arnilo/prism-knowledge/wiki and /rag ship on the experimental dist-tag (bun add @arnilo/prism-knowledge@experimental), outside the stability promise.
Scripts
| command | action |
|---------|--------|
| bun ci | Install dependencies from the committed bun.lock (frozen) |
| bun run typecheck | Build and type-check the kernel, every workspace, and the examples |
| bun run test | Run the network-free tests |
| bun run test:coverage | Coverage gate with Bun-measured floors (scripts/coverage-thresholds.json) |
| bun run test:live | Run live suites whose credentials are present (skip the rest) |
| bun run release:gate | The release gate: reference host, driver, kernel constraints, and compat baselines |
Non-goals
- Privileged tools, MCP servers, telemetry, credentials, or databases activated by install. The host lists every package it loads.
- A bundled TUI, sandbox, or database driver in the kernel. Packages and hosts own them.
- Package auto-discovery. Nothing loads that the host did not list.
