omp packages

@sepehr500/context-zero0.1.0

Context Zero: every MCP server and agent skill behind one Unix CLI (coz), at near-zero context cost.

sepehr500 Published 7 days ago MIT ~0 downloads/mo

Untested on omp

This is a pi package. No one has reported whether it works on omp yet. If you try it, add your result below.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

Context Zero mascot: a cute ghost shaped like a zero

Context Zero

Every MCP server and agent skill behind one Unix CLI, coz, at near-zero context cost.

Agents drive coz through bash, so no MCP tool declarations or skill lists sit in the model's context. The agent finds what it needs by searching, a page at a time. The prompt cost is about 250 tokens, and it stays the same however many servers you add.

coz search 'create issue'                 # ranked tools + skills (fuzzy, synonyms, filters), paginated
coz linear.save_issue --help              # compact signature and usage line
coz linear.list_issues --assignee me --limit 5 | jq -c '.issues[] | {title, url}'
coz linear.get_issue LIN-123              # required params by position
coz notion.create_page --title Report --content @report.md   # file contents, no escaping
git diff | coz linear.save_comment LIN-123 --body @-         # stdin into one field
coz skill show pdf-tools                  # load a skill's instructions

Install

Requires Node.js 24 or newer, which runs the TypeScript sources directly, with no build step.

As a Pi package (includes the extension and bundled coz CLI):

pi install npm:@sepehr500/context-zero

Or install directly from GitHub:

pi install git:github.com/sepehr500/context-zero

Disable Pi's built-in MCP extension (via pi config or "-builtin:mcp" in extensions in ~/.pi/agent/settings.json) so MCP servers aren't loaded twice.

Standalone CLI (for use outside Pi):

npm install -g @sepehr500/context-zero
coz ls                                   # reads your existing mcpServers configs

From source:

git clone https://github.com/sepehr500/context-zero && cd context-zero
npm ci --omit=dev
ln -s "$PWD/bin/coz" ~/.local/bin/coz    # any directory on your PATH
coz ls                                   # reads your existing mcpServers configs

Tool arguments

call is optional, since only tool ids contain a dot. Arguments are read against the tool's schema:

Form Meaning
<value> fills the next required parameter not given by name
--name value, --name=value, name=value converted to the parameter's declared type
--flag / --no-flag booleans
--tag a --tag b, --tag a,b, tag+=c arrays
name:=<json> raw JSON
a.b=v, --a.b v nested objects
name=@path, name:=@file.json, name=@- a file's contents, a file parsed as JSON, stdin
name=@@x a literal value starting with @
--args '<json>' or - a whole JSON object, from the flag or from stdin
-- … everything after this is positional values
  • Repairing arguments. Names match regardless of case and separators, so --order-by and order_by both become orderBy. Values that arrive as JSON are converted too: "5" → 5, "a,b" → ["a","b"], "true" → true. For union types such as string | string[] (common in Python servers), structured input wins: --metrics Cost sends ["Cost"], and JSON text is sent parsed. These are applied only when the mapping is unambiguous.
  • Unknown names are rejected with a "did you mean" suggestion instead of being sent to a server that would ignore them. --loose sends them anyway.
  • Flag names shared with coz. When a tool parameter has the same name as an coz flag (--timeout, --args, …), the flag goes to the tool if it has a value, or if the parameter is a boolean.

Design

  • Daemon + thin client. The client parses arguments, ranks, and formats, and it starts in about 90 ms. A per-user daemon (started on first use, exits after 30 min idle) holds the MCP connections. That keeps stdio servers warm and their sessions alive, and it makes loops and xargs -P cheap. It restarts automatically when the source changes.
  • Pure Unix output. stdout carries only data. Footers, hints, and progress go to stderr.
    • Structured results print as JSON. JSON text from servers is compacted, which saves tokens.
    • Images and blobs are written to files, and their paths are printed.
    • Exit codes: 0 ok · 1 tool error · 2 usage/not found · 3 sign-in or trust needed · 4 connection/timeout.
  • Bounded discovery. search, ls, res ls, and skill ls/show are paginated by count and bytes. Cursors are tied to the query and the index version. --all turns paging off for pipes.
  • call never truncates, because an intermediate pipeline stage needs all of its input. The Pi extension trims oversized output only where it would reach the model.

Search

BM25 ranking across fields, with name matches weighted highest, then title, server, description, parameters, and skill headings. On top of that:

  • Identifiers are split, so listIssues, list_issues, and list-issues all match "list issues".
  • Light stemming, prefix and typo expansion, and a small thesaurus (ticket→issue, remove→delete, create→save, …).
  • A read-intent prior for queries without an action verb, and per-server diversity within the relevant band of results.

Query syntax: server:linear,notion kind:tool|skill ro:true destructive:false param:cursor "exact phrase" -exclude linear.*issue* (glob on ids). --regex matches ids and descriptions.

Configuration

coz reads existing MCP configs in the standard mcpServers format. Later entries win:

scope files
global ~/.config/mcp/mcp.json, ~/.pi/agent/mcp-adapter.json, ~/.pi/agent/mcp.json, ~/.config/coz/servers.json
project (git root → cwd) .mcp.json, .pi/mcp.json
  • Enable and disable with coz enable|disable <server> [--project]. These choices are saved in ~/.config/coz/overrides.json, never in the server's own config, which other MCP clients may share. A project choice beats a global one.
  • Project servers need trust. Run coz trust at a terminal, or /coz trust in Pi. Trust is bound to a hash of the definition, so editing a definition revokes it.
  • HTTP servers use OAuth. Run coz auth login <server>. Tokens are stored in ~/.config/coz/auth/ (mode 600) and refreshed automatically.
  • Values support ${VAR} and ${VAR:-default} interpolation, plus ~/ expansion.

~/.config/coz/config.json:

{ "skills": { "exclude": ["impeccable"], "roots": ["/extra/skills/dir"] } }

Skill roots are searched in this order, and the first skill with a given name wins:

  1. Project, Pi-native: .agents/skills, .pi/skills
  2. Project: .claude/skills, .codex/skills
  3. Global, Pi-native: ~/.pi/agent/skills, ~/.agents/skills
  4. Global: ~/.claude/skills, ~/.codex/skills, then the extra roots

Skills with disable-model-invocation: true don't appear in search.

Pi extension (pi/)

Install with pi install npm:@sepehr500/context-zero (or add a local checkout's pi directory to extensions in ~/.pi/agent/settings.json), and disable Pi's built-in MCP extension:

{ "extensions": ["-builtin:mcp"] }

The extension automatically puts its bundled coz binary on PATH inside Pi (override with COZ_BIN).

  • System prompt. It replaces <available_skills> with a short <coz> section. It edits systemPromptOptions directly, so the prompt cache survives.

  • Skills. It registers the skills Pi doesn't discover itself, so /skill:name keeps working.

  • Context guard. When a top-level bash command runs coz and prints more than 10 KB, the model gets the head and tail plus the path to the full output (COZ_GUARD_BYTES sets the threshold). Codemode's nested calls get the whole output.

  • Images. [image: …] results from coz become image attachments, so the model sees them. Only files in coz's private output directory are attached, at most 4 per result.

  • Confirmation. It asks before coz call runs a tool that declares destructiveHint (COZ_CONFIRM=off turns this off).

  • /coz panel: a popup server manager like Pi's /mcp, floating over the transcript. Servers that need attention come first. For each server you can:

    • sign in (opens the browser; esc cancels) or sign out
    • trust a project server
    • reconnect
    • browse its tools and their details
    • enable or disable it everywhere or only in this project

    Outside the TUI, /coz status|login|logout|trust|restart do the same jobs as plain commands.

Development

npm test            # unit + integration (isolated HOME/COZ_HOME, fixture MCP server)
npm run typecheck   # CLI and Pi extension

COZ_HOME=/tmp/x isolates all of coz's state.

License

MIT