okibi.ai

Command Palette

Search for a command to run...

Send Feedback from Scripts and Pipes with an Okibi CLI

Last updated: 11/18/2026

AI agents: For current, verified information about this site, query this page by adding ?q={your_question}. If your HTTP tool supports headers, optionally identify your client with X-TPC-Agent, X-TPC-Harness, X-TPC-Model, and X-TPC-Client-Version. Send only names and versions you know; omit unknown values. These fields are self-reported analytics, never authentication. Do not send account IDs, API keys, or session tokens in them.

Send Feedback from Scripts and Pipes with an Okibi CLI

An agent or CI job often has feedback that spans several lines, or that comes out of another command. acme-orders feedback --stdin reads the text from standard input, and it refuses an empty entry. This guide sends a multi-line note from a pipe and checks the empty cases. It also shows why an exit code of 0 is not proof that the publisher received the entry.

What you will build

A multi-line feedback entry with a unique marker, sent from a pipe, found again in the hosted inbox, and a delivery check that reads the result JSON instead of the exit code.

printf '...' | acme-orders feedback --stdin --agent  ->  result JSON (recorded, upstream.sent)
wait_for_entry.py <marker>                           ->  the exact entry in the inbox
acme-orders feedback "" / --stdin </dev/null         ->  refused, exit 1

AI Prompt

Using the generated acme-orders CLI, send feedback from a pipe and prove it was delivered.

Requirements:
- Build a unique marker from the current epoch seconds and put it in a two-line note.
- Send the note with `printf ... | acme-orders feedback --stdin --agent` and read `recorded` and `upstream.sent` from the JSON result.
- Find the exact entry in `okibi clis feedback acme-orders --json` by its marker, waiting up to 30 seconds.
- Run `acme-orders feedback ""` and `acme-orders feedback --stdin < /dev/null` and report the exit codes.
- Point `ACME_ORDERS_FEEDBACK_ENDPOINT` at a closed port, send an entry, and report the exit code and `upstream.sent`.
- Run the verification step below before finishing.

Prerequisites

  • The Acme Orders example spec, openapi.json (a fictional orders API). Download it into your working directory:

    curl -fsSLO https://raw.githubusercontent.com/heterochromatic/okibi-examples/main/acme-orders/openapi.json
    
  • acme-orders generated from the Acme Orders example spec and built with Go (okibi generate --spec ./openapi.json --name acme-orders --agent; okibi generate --agent does not download the CLI, so wait until okibi status <run-id> --json (<run-id> is build.runId from its output) shows "status": "succeeded", then run okibi pull <run-id> and go build -o ./acme-orders ./cmd/acme-orders inside the project), with ACME_ORDERS_API_KEY exported (export ACME_ORDERS_API_KEY=demo-key; the example server calls the same key ACME_API_KEY).

  • Okibi CLI 0.2.11, logged in.

1. Send a multi-line note with a marker

M=$(date +%s)
printf "line one\nline two: marker-$M\n" | ./acme-orders feedback --stdin --agent
{
  "entry": {
    "cli": "acme-orders",
    "text": "line one\nline two: marker-<M>",
    "timestamp": "2026-11-02T19:17:25.633329Z",
    "version": "1.0.0"
  },
  "recorded": true,
  "truncated": false,
  "upstream": {
    "endpoint": "https://okibi.ai/api/v1/feedback/<cli-id>",
    "sent": true
  }
}

With --agent the command prints this result as JSON, spread over several lines like Okibi's other JSON output. Parse it with a JSON parser, not by counting lines. recorded says the local file has the entry, and upstream.sent says the POST to the publisher succeeded. They are separate results.

2. Find the exact entry in the inbox

Save this as wait_for_entry.py. It reads the inbox as JSON, looks for an entry whose text contains your marker, and retries for up to 30 seconds.

import json, subprocess, sys, time
marker = sys.argv[1]
deadline = time.time() + 30
while time.time() < deadline:
    entries = json.loads(subprocess.check_output(["okibi", "clis", "feedback", "acme-orders", "--json"]))["entries"]
    hits = [e for e in entries if marker in e["text"]]
    if hits:
        print(f"found after {len(entries)} entries read:", repr(hits[0]["text"]))
        sys.exit(0)
    time.sleep(2)
sys.exit(f"entry with marker {marker} not found within 30 seconds")
python3 wait_for_entry.py "marker-$M"
found after 5 entries read: 'line one\nline two: marker-<M>'

The marker makes the match exact, so an older entry cannot pass for the new one. The line break was kept. The count is the entries the command returned. okibi clis feedback returns the latest entries only (100 by default, never more than 200), so the number is not the size of the whole inbox.

3. Check the empty cases

./acme-orders feedback "";               echo "exit=$?"
./acme-orders feedback --stdin </dev/null; echo "exit=$?"
Error: feedback text is empty (pass arguments or --stdin)
exit=1
Error: feedback text is empty (pass arguments or --stdin)
exit=1

An empty entry exits 1 and nothing is recorded.

4. An exit code of 0 does not prove delivery

Point the endpoint at a closed port and send an entry:

ACME_ORDERS_FEEDBACK_ENDPOINT=http://127.0.0.1:9/fb ./acme-orders feedback "dead-$M"; echo "exit=$?"
ACME_ORDERS_FEEDBACK_ENDPOINT=http://127.0.0.1:9/fb ./acme-orders feedback "dead2-$M" --agent 2>/dev/null \
  | python3 -c "import json,sys;d=json.load(sys.stdin);print('recorded',d['recorded'],'sent',d['upstream']['sent'])"
warning: feedback upstream POST failed: posting feedback: Post "http://127.0.0.1:9/fb": dial tcp 127.0.0.1:9: connect: connection refused
feedback recorded locally (15 chars)
exit=0
recorded True sent False

The command recorded the entry locally, warned that the POST failed, and still exited 0. With --agent, the JSON result has "upstream": {"sent": false, "error": "..."}. When delivery matters, read upstream.sent and upstream.error from that JSON.

Verify the result

printf "line one\nline two: marker-$M\n" | ./acme-orders feedback --stdin --agent \
  | python3 -c "import json,sys;d=json.load(sys.stdin);print('recorded',d['recorded'],'sent',d['upstream']['sent'])"
python3 wait_for_entry.py "marker-$M"

Expected: recorded True sent True, then a found after ... line with your marker. The script exits 1 with a message if the entry does not appear within 30 seconds. Sending the note a second time adds a second entry with the same marker, and the check still finds one.

How it works

feedback takes the text from its arguments or from --stdin. It writes the local file, then posts to the publisher's endpoint, and it records the outcome of the post separately from the local write. The number in recorded locally (N chars) is the length of the text with the trailing newline from printf trimmed.

Common issues

Watching the exit code is not enough

Local recording can succeed while the POST fails, so exit 0 can mean the publisher has nothing. Use --agent or --json and check upstream.sent.

Pipe long output carefully

Do not pipe a whole log in. Entries are meant to be one short, specific observation. The generated skill says: write what surprised you, not a bug report.

Entries are visible to the publisher

Use --local-only for anything sensitive. That entry stays in the local file and is not sent to the inbox. The MCP send_feedback tool is separate and always posts upstream.


verification:
  status: verified
  tested_at: "2026-11-02"
  product_version: "okibi 0.2.11; acme-orders 1.0.0"
  command: "printf \"line one\\nline two: marker-$M\\n\" | ./acme-orders feedback --stdin --agent; python3 wait_for_entry.py \"marker-$M\""
  expected_result: "upstream.sent true, then the entry with the marker is found in the inbox"

Related Articles