npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@adhd/sox-host-registry

v0.7.0

Published

Pluggable per-host registry: claude, codex, opencode, and agent-mcp modules with detect/scopePaths/surfaces + per-host agent renderers

Readme

@adhd/sox-host-registry

The pluggable per-host registry for the soxe ecosystem: three self-contained host modules (Claude Code, Codex, OpenCode), each declaring how to detect that host in a workspace, where its per-scope config/agent/skill files live on disk, and how to render a host-agnostic agent definition into that host's native format. This is the only package in the ecosystem allowed to contain literal host-discovery paths (.claude/, .codex/, .opencode/, ~/.claude/, ~/.codex/, ~/.config/opencode/) — everything else resolves a target through it instead of hard-coding a path.

pnpm add @adhd/sox-host-registry

Quick start

import { detectHosts, getHost, listHosts } from '@adhd/sox-host-registry';

listHosts(); // ['claude', 'codex', 'opencode']

// Which host(s) are set up in this workspace?
const detected = detectHosts(process.cwd()); // e.g. ['claude']

const claude = getHost('claude');
claude.scopePaths('project'); // { project: '.claude' } — relative to the workspace root
claude.scopePaths('user');    // { user: '/Users/you/.claude' } — home-expanded, absolute
claude.surfaces.agent;        // { capability: 'file-drop', paths: { project: '.claude/agents', user: '/Users/you/.claude/agents' } }
claude.surfaces['mcp-server'].capability; // 'config-merge'

Rendering one agent definition for every host

agentRenderers is the "author once, install everywhere" half of the package: write a single host-agnostic AgentIr, and get back the exact frontmatter/config value each host expects — Claude tool names get capitalized and MCP servers become mcp__<server>__* wildcards, OpenCode gets YAML frontmatter with mode/permission, Codex gets a TOML [agents.<name>] value.

import { agentRenderers } from '@adhd/sox-host-registry';
import type { AgentIr } from '@adhd/sox-host-registry';

const researcher: AgentIr = {
  name: 'researcher',
  description: 'Discovery researcher for third-party tools, patterns, and use cases before you build.',
  model: 'sonnet',
  temperature: 0.4,
  mode: 'all',
  tools: [
    'read',
    'bash',
    { logical: 'search', server: 'search' },
  ],
  permission: {
    read: 'allow',
    bash: { '*': 'allow', 'rm -rf *': 'deny' },
  },
};

const prose = '# researcher\n\nYou are a research agent.\n';

const forClaude = agentRenderers.claude.render(researcher, prose);
// { kind: 'file-body', content: '---\nname: researcher\n...tools: Read, Bash, mcp__search__*\n---\n# researcher\n...' }

const forCodex = agentRenderers.codex.render(researcher, prose);
// { kind: 'config-value', value: { description: '...', model: 'sonnet', prompt: '# researcher\n...' } }
// The install engine's config-merge capability serializes this object to TOML
// at keyPath `agents.researcher` — codex has no file-drop surface for agents.

API reference

Registry lookup

function getHost(name: string): HostModule;       // throws on an unknown host name
function listHosts(): string[];                    // ['claude', 'codex', 'opencode']
function detectHosts(workspaceRoot: string): string[]; // hosts whose detect() is true here
function resolveWorkspaceRoot(workspaceRoot?: string): string; // workspaceRoot ?? process.cwd()

const claudeHost: HostModule;
const codexHost: HostModule;
const opencodeHost: HostModule;

HostModule — the shape every host implements

type HostScope = 'project' | 'user' | 'local' | 'org';

interface HostModule {
  readonly host: string;
  detect(workspaceRoot: string): boolean;
  scopePaths(scope: HostScope): Partial<Record<HostScope, string>>;
  readonly surfaces: SurfaceMap; // extension type -> Surface
  readonly render?: HostRenderer; // present on claude/opencode/codex
}

type CapabilityId =
  | 'file-drop'       // write a file/dir at a discovery path
  | 'config-merge'    // merge a key into a shared JSON or TOML config file
  | 'array-merge'     // append to arrays (permissions/env) with deny-wins semantics
  | 'object-array-merge'
  | 'bin-link'        // executable on PATH
  | 'run-service'     // soxe spawns + supervises
  | 'materialize';    // place built code at a stable store path

interface Surface {
  capability: CapabilityId;
  format?: 'json' | 'toml';
  mcpConfig?: McpConfig;
  postInstallHint?: string;
  paths: Partial<Record<HostScope, string>>;
}
type SurfaceMap = Record<string, Surface>;

Agent rendering

interface AgentIr {
  name?: string;
  description?: string;
  model?: string;
  temperature?: number;
  mode?: string;
  tools?: AgentToolRef[]; // string, or { logical: string; server: string }
  permission?: Record<string, string | Record<string, string>>;
}
interface AgentOverride {
  name?: string; description?: string; model?: string; temperature?: number; mode?: string;
  tools?: string[];
  permission?: Record<string, string | Record<string, string>>;
  version?: string;
  toolMap?: Record<string, string>; // logical server name -> concrete registration key
  fallbackPath?: string;
}
type RenderedArtifact =
  | { kind: 'file-body'; content: string }
  | { kind: 'config-value'; value: unknown };

interface HostRenderer {
  renderHeader(ir: AgentIr, overrides?: AgentOverride): Record<string, unknown>;
  renderToolNames(ir: AgentIr, overrides?: AgentOverride): string | null;
  render(ir: AgentIr, prose: string, overrides?: AgentOverride): RenderedArtifact;
}

const agentRenderers: { claude: HostRenderer; opencode: HostRenderer; codex: HostRenderer };
function stripFrontmatter(content: string): string;
function yamlScalar(value: unknown): string;
function yamlStringify(obj: Record<string, unknown>): string;

Helpers

function expandHome(p: string): string;              // leading ~ -> effective home dir
function existsIn(workspaceRoot: string, rel: string): boolean; // for detect() implementations

Invariants / gotchas

  • This is the only package allowed to hard-code a host discovery path. If you find .claude/, .codex/, or .opencode/ written literally anywhere else in a consumer, that's a bug to route through getHost(...).scopePaths(...) instead.
  • Claude's managed (org/enterprise policy) tier is never emitted. scopePaths() and surfaces for claudeHost never produce a path under that tier — soxe never writes it.
  • expandHome reroutes under SOX_SANDBOX_ROOT when that env var is set (test/sandbox isolation only), read at call time, not at import time. This is a different switch from SOX_ECOSYSTEM_HOME in @adhd/sox-host-runtime — the data root never reroutes a host placement path, and the sandbox root never moves soxe's own bookkeeping.
  • Claude MCP entries require an explicit type ("http" or "sse"; "stdio" for local) — a url entry with no recognized type is silently treated as broken and skipped by Claude Code itself.
  • User-scope Claude MCP config lives in ~/.claude.json, not settings.json.