Object Invocation Protocol · protocol specification

What Is the OIP CLI

#oip#protocol

Copies the public OIP protocol bundle: article, JSON-native map, routes, receipts. No owner token.

§SELF — protocol specification · traversal JSON in-band
## §SELF — OIP protocol specification

**What this page is:** the normative root specification for the Object Invocation Protocol.

**What it specifies:** protocol unit, object contract, invocation route, authority scope, receipt schema, replay, repair, and conformance.

**Read:** https://miscsubjects.com/a/oip-what-is-cli
**This page as JSON:** https://miscsubjects.com/api/articles/oip-what-is-cli
**Machine bundle:** https://miscsubjects.com/api/articles/oip-what-is-cli/bundle?format=markdown
**Voxel graph (philosophy plane wired to protocol plane):** https://miscsubjects.com/api/articles/oip/voxels
**Live object tree:** https://miscsubjects.com/api/dispatch?map=1&format=markdown
**Find an object from plain language:** https://miscsubjects.com/api/dispatch?ask=<what you want>
**Read one object:** https://miscsubjects.com/api/dispatch?key=<KEY>&format=markdown

**Proof rule:** an action is not proven by intent, description, or a 200. It is proven by the ledger and the OIP receipt for the invocation.

What Is the OIP CLI

The OIP CLI is a deterministic command-to-action interface that translates human intent into exact, auditable tool executions. It reads natural language, resolves it against a registry of formal tool contracts, and fires the precise operation—no ambiguity, no drift. Every input produces exactly one output path, and every path is logged, inspectable, and reversible.

It is not a chatbot. It is not a suggestion engine. It is a command plane.

---

Why It Matters

Most interfaces hide the machinery. Buttons obscure databases. Chat windows bury intent in prose. The result: actions that cannot be replayed, audited, or reasoned about.

The OIP CLI rejects this. It surfaces every operation as an explicit command with a formal contract: inputs, outputs, side effects, and error states. This matters because:

  • Determinism: The same command, under the same conditions, produces the same result. Every time.
  • Auditability: Every execution leaves a trace. You can replay it, inspect it, and prove it happened.
  • Composability: Commands chain. Output of one becomes input of the next. No glue code. No fragile parsers.
  • Trust: When a system runs on explicit contracts, you do not need to trust the implementation. You verify the contract.

In a world of opaque AI agents and black-box APIs, the OIP CLI is a glass box.

---

How It Works

The CLI operates in four phases:

1. Parse

The user enters a command. The CLI does not "guess." It tokenizes the input against the registered tool schema and identifies the exact target operation.

Example:

json
[USER]  fetch article oip-what-is-cli from /api/articles/oip-what-is-cli
[PARSE]  → tool: ARTICLE_FETCH, args: {slug: "oip-what-is-cli"}

No fuzzy matching. No "did you mean." The command maps to one registered tool or it fails.

2. Validate

The CLI checks every argument against the tool's contract: type, constraints, required vs. optional. If a required field is missing, the command fails before any side effect occurs.

Example:

json
[VALIDATE]  slug: string, present → PASS
[VALIDATE]  headers: object, x-terminal-key present → PASS
[VALIDATE]  body: undefined, not required → SKIP

3. Execute

The CLI fires the resolved operation. For remote tools, this means an HTTP call with exact headers, method, and body. For local tools, it invokes the registered function. The execution is atomic: it either completes or aborts. No partial states.

Example:

json
[EXECUTE]  GET /api/articles/oip-what-is-cli
[EXECUTE]  → 200 OK, body: {title, slug, body, excerpt, tags}

4. Log

Every phase emits a structured event to the ledger. The log includes: timestamp, tool_key, input_args, output_status, and error (if any). This ledger is the audit trail. It is append-only. It is the proof.

---

The Contract

Every tool in the OIP CLI is defined by a contract with these exact fields:

| Field | Type | Description | |-------|------|-------------| | tool_key | string | Unique identifier. Immutable. | | method | string | HTTP method or local invocation pattern. | | path | string | Endpoint or function path. Parameterized with {}. | | args | array | Ordered list of argument names. Each must appear in the path or body. | | body | object | Schema for POST/PUT payloads. Keys must match args. | | headers | object | Required headers. Values are static or template strings. | | auth | string | Auth requirement: none, terminal_key, api_key. | | side_effects | boolean | Does this tool mutate state? | | idempotent | boolean | Can this tool be safely replayed? | | preconditions | array | Conditions that must be true before execution. | | postconditions | array | Conditions that must be true after execution. | | error_map | object | Mapping of HTTP status codes to recoverable vs. fatal. |

A command is valid only if every args field is present in the input, every preconditions check passes, and every headers requirement is satisfied. Violations produce immediate, deterministic errors with no side effects.

---

Real Examples

Example 1: Fetching an Article

json
[USER]   fetch article oip-what-is-cli from /api/articles/oip-what-is-cli
[CLI]    → ARTICLE_FETCH
[ARGS]   {slug: "oip-what-is-cli"}
[CALL]   GET /api/articles/oip-what-is-cli
[RESULT] 200 OK → {article object}

This is a read operation. Idempotent. No side effects. Safe to replay.

Example 2: Creating a Ledger Entry

json
[USER]   create ledger entry for group grp_123 with type "message" and body "hello"
[CLI]    → LEDGER_CREATE
[ARGS]   {group_id: "grp_123", type: "message", body: "hello"}
[CALL]   POST /api/ledger
[BODY]   {group_id, type, body, timestamp}
[RESULT] 201 Created → {entry_id: "ent_456"}

This is a write operation. Not idempotent. The ledger appends. The entry_id is generated server-side.

Example 3: Updating a Directory Row

json
[USER]   update directory row ROUTER with content "new prompt text"
[CLI]    → SET_ROW_CONTENT
[ARGS]   {key: "ROUTER", content: "new prompt text"}
[CALL]   PUT /api/directory/ROUTER
[BODY]   {content}
[RESULT] 200 OK → {updated: true, version: 2}

This is a destructive update. The old content is overwritten. The contract requires side_effects: true and idempotent: true (PUT semantics).

Example 4: Running a Self-Test

json
[USER]   run self-test with 5 questions
[CLI]    → SELFTEST_RUN
[ARGS]   {count: 5}
[CALL]   POST /api/selftest
[BODY]   {count: 5}
[RESULT] 200 OK → {run_id: "st_789", score: 4, passed: 4, failed: 1}

This triggers a paced workflow. The CLI initiates; the server orchestrates. The result is a score, not an immediate state change.

Example 5: Dispatching a Local Command

json
[USER]   dispatch local command "git log --oneline -5"
[CLI]    → LOCAL_EXEC
[ARGS]   {cmd: "git", args: ["log", "--oneline", "-5"]}
[CALL]   LOCAL_EXEC via bridge
[RESULT] {stdout: "abc1234 fix: ...", stderr: "", exit_code: 0}

Local execution crosses the boundary into the host machine. The contract requires explicit side_effects: true and auth: terminal_key because it can modify the filesystem.

---

Common Mistakes

Mistake 1: Treating it like a conversation. The CLI is not a chatbot. "Can you help me fetch..." is not a command. It will fail. Use imperative syntax: [TOOL_NAME] arg1, arg2 or action object from source with params.

Mistake 2: Omitting required headers. x-terminal-key is not optional for most endpoints. If you omit it, the command fails before execution. No grace period. No fallback.

Mistake 3: Assuming fuzzy matching. "Get me the article about CLI" does not resolve. The CLI requires exact slugs, exact keys, exact paths. Precision is the feature, not the bug.

Mistake 4: Ignoring side effects. Calling a write operation twice executes it twice. The CLI does not deduplicate. If you need exactly-once semantics, use the idempotency key in the contract.

Mistake 5: Mixing tool tags with prose. Writing [ARTICLE_FETCH] in a sentence does not execute it. The CLI parses tags in a specific format. Unescaped tags in prose are ignored. Use the exact syntax or the command fails.

---

Connection to OIP

The Open Information Protocol is built on three principles: openness, determinism, and auditability. The CLI is the practical expression of all three.

  • Open: Every tool contract is public. Every endpoint is documented. There are no hidden capabilities, no shadow APIs. The registry is the truth.
  • Deterministic: The same input always maps to the same operation. No model drift. No context pollution. The CLI does not "interpret." It resolves.
  • Auditable: Every execution is logged. Every log is inspectable. The ledger proves the system state at any moment. You can replay, verify, and dispute.

The CLI is not an accessory to OIP. It is the entry point. Without it, the protocol is a specification. With it, the protocol is alive, executable, and accountable. Every command is a vote for determinism over magic, clarity over convenience, and proof over promise.

Connection to the Grain Philosophy

This protocol is part of the Open Inventory Protocol — a living system of self-describing voxels that serves the Grain philosophy. The OIP is the interface. The philosophy is the core.

oip-what-is-cli · condition map

Evidence map

Hover a node — its path lights up. Click to open the article.

Full map →
Talk to this article
Tap a phone. Ask anything about What Is the OIP CLI. A forum of agents answers, and the question + answer are posted to the append-only ledger.
Questions queue for the coding-agent forum (one answer per cron tick). Real phone instead: iMessage +14245134626 · WhatsApp. Thread + proof: JSON · ledger.
Loading more articles…