m3tam3re
  • Joined on 2023-07-18

@m3ta/prism (0.1.0)

Published 2026-07-07 07:36:25 +02:00 by m3tam3re

Installation

@m3ta:registry=https://code.m3ta.dev/api/packages/m3tam3re/npm/
npm install @m3ta/prism@0.1.0
"@m3ta/prism": "0.1.0"

About this package

PRISM OpenCode plugin and setup utilities.

PRISM

PRISM is an OpenCode plugin package for a local Markdown memory vault. The current MVP implements setup, Layer-1 instruction loading, vault recall, pending memory candidate capture from OpenCode idle sessions, Dream-Pass processing, and reviewed Layer-1 approvals.

Requirements

  • Linux
  • Bun 1.3+
  • OpenCode 1.17.x

Install

Configure the private Gitea npm registry once per machine. Use a token with package read access; never commit tokens.

npm config set @m3ta:registry https://code.m3ta.dev/api/packages/m3tam3re/npm/
npm config set //code.m3ta.dev/api/packages/m3tam3re/npm/:_authToken YOUR_GITEA_TOKEN

Install from the private registry:

bunx --package @m3ta/prism prism-setup

For reproducible rollout, pin the package version in the OpenCode config written by setup:

bunx --package @m3ta/prism@0.1.0 prism-setup --package @m3ta/prism@0.1.0

For local development or registry recovery, pack and install via a file: spec:

bun install
npm run pack:local
bunx --package ./az-prism-0.1.0.tgz prism-setup --package "file:$PWD/az-prism-0.1.0.tgz"

Use file:/absolute/path/package.tgz or name@file:/absolute/path/package.tgz for OpenCode tarball fallback installs. Do not rely on file:// URLs.

Quickstart

Initialize the default user vault and OpenCode config:

prism-setup

This is idempotent. Re-running it preserves existing vault content and only appends missing OpenCode config entries.

Created vault layout under ~/vault:

00-AKTIV.md
00-LEARNINGS.md
00-DECISIONS.md
00-PREFERENCES.md
10-Inbox/
20-Projects/
30-Knowledge/
40-Learnings/
50-Decisions/
55-Failures/
60-Identity/
70-People/
80-Shared/
90-Archive/

The command updates ~/.config/opencode/opencode.json with:

  • plugin: includes @m3ta/prism or your --package value
  • instructions: includes the four Layer-1 files so new OpenCode sessions load them

Project-local config is also supported:

prism-setup --project

Useful overrides:

prism-setup \
  --vault-dir ~/vault-work \
  --opencode-config ~/.config/opencode/opencode-work.json \
  --package '@m3ta/prism'

Equivalent environment variables:

  • PRISM_VAULT_DIR
  • PRISM_OPENCODE_CONFIG
  • PRISM_PACKAGE_SPEC

OpenCode plugin behavior

The package exports an OpenCode plugin. Its config hook adds the Layer-1 vault files to config.instructions. Future PRISM agents should be registered by mutating config.agent in this hook; setup-time agent file copying is only a compatibility fallback.

The plugin also registers a recall tool. It searches the configured vault with QMD first and falls back to rg when QMD is missing or returns no usable result. Tool results are normalized as:

{
  "path": "/home/user/vault/30-Knowledge/example.md",
  "line": 12,
  "snippet": "matching line text",
  "score": 1,
  "matchType": "literal",
  "source": "rg"
}

When OpenCode emits session.idle, PRISM reads recent session messages through the OpenCode client, applies the MVP classifier with classifierModel: "auto", blocks obvious secrets, and writes one stable JSONL candidate per turn to ~/vault/pending.jsonl. Repeated idle events for the same session text are idempotent.

Process pending candidates once:

prism dream --once

Dream-Pass writes structured Markdown notes under ~/vault/40-Learnings/ and stages Layer-1 additions in ~/vault/00-PENDING-CHANGES.md; it never edits Layer-1 files directly. Review and apply or reject staged changes with:

prism vault review --accept
prism vault review --reject

Approval checks the target Layer-1 base hash before writing. If the file changed after staging, the change remains pending for manual resolution.

Recovery notes

If QMD is not installed, setup still works and recall uses the rg fallback. Install ripgrep on fresh Linux systems before using recall.

If pending.jsonl contains a corrupt line, PRISM skips that line during reads and preserves valid entries when appending the next candidate.

If OpenCode does not load the plugin from the registry, use the tarball fallback above and pass the same file:/absolute/path/package.tgz value to prism-setup --package.

Publishing

The package publishes to the private Gitea npm registry configured in package.json#publishConfig:

bun install
bun test
bun run typecheck
bun run build
npm publish

Dry-run the package before publishing:

npm run publish:dry

If this is a first-time machine, verify registry authentication before publishing:

npm whoami --registry https://code.m3ta.dev/api/packages/m3tam3re/npm/

Development

bun install
bun test
bun run typecheck
bun run build

Dependencies

Dependencies

ID Version
@opencode-ai/plugin 1.17.9

Development Dependencies

ID Version
@types/bun latest
@types/node ^24.0.0
typescript ^5.9.0
Details
npm
2026-07-07 07:36:25 +02:00
0
UNLICENSED
78 KiB
Assets (1)
Versions (2) View all
0.1.1 2026-07-07
0.1.0 2026-07-07