Skip to content

Latest commit

 

History

History
293 lines (205 loc) · 19.4 KB

File metadata and controls

293 lines (205 loc) · 19.4 KB

Command reference

The README keeps the first-run path short. This page carries the command details that are useful once you are wiring Tenjin into scripts, agent permissions, or a longer-running harness.

Every command accepts the global flags:

Flag Effect
--json Emit one machine-readable JSON envelope and suppress human stderr rendering.
--base-url <url> Point this run at another Tenjin deployment.
--timeout <ms> Per-request timeout. Defaults to 10000.

Setup

tenjin install

Detects Claude Code, Codex, or a shared Agent Skills directory; wires Tenjin skills; can add the free command permissions; can register search hooks; can create a local Base wallet; then runs doctor.

Useful flags:

Flag Values Effect
--harness <name> claude, codex, shared Target one harness. Repeatable.
--dry-run Print what would change without writing, including the permission rules a real run would add.
--publish-mode <mode> review, auto, full-auto Set publish consent non-interactively. Defaults to auto, which also writes Bash(tenjin publish:*) and Bash(tenjin edit:*).
--no-allow-free-verbs Do not write harness permission rules.
--search-hooks <mode> auto, remind, off Register search hooks in this mode.
--no-hooks Register no hooks this run.
--no-wallet Create no wallet.

install is idempotent. Re-run it after upgrading the CLI or changing harnesses.

Hooks

install registers four Claude Code hooks. The WebSearch hook (hooks.searchMode) checks Tenjin before a web search. The dispatch hook, on the same key, does the same when a subagent is dispatched, sending the dispatch's description plus at most 400 characters of its prompt, at most 10 lookups per session. Nothing fires on a WebFetch. The Stop hook (hooks.stopNag) reminds you at the end of a turn about searches that are still open. The SessionStart hook (hooks.sessionPrimer) prints one paragraph on when to search first, and makes no network call.

The Stop hook only ever raises a MISS. A search that returned candidates is not an open loop, so nothing is reminded about it: a silent end-of-turn after a successful search is the hook working, not the hook broken. It also stays silent once a loop is closed (by tenjin publish --search-id or tenjin outcome), once a MISS ages past the session window, and after it has raised a given search once. hooks.stopNag deliberate-only drops the batch about web-search-hook misses and keeps the reminders about searches you ran yourself. Dispatch misses are never raised at all: they are demand data, not questions you asked to be reminded about, and they hold at most 15 of the store's 50 slots so a wide fan-out cannot evict a search you may still want to buy from.

Hooks are read once at session start, so restart Claude Code after registering them.

tenjin uninstall

Removes what tenjin install wrote: Tenjin skills, hook scripts, Tenjin hook entries, Tenjin permission rules, and older pointer lines in CLAUDE.md or AGENTS.md.

Your wallet, config, library, search history, and older candidate data under ~/.tenjin stay in place. The one thing it removes there is the generated hook scripts in ~/.tenjin/hooks, which install wrote and puts back. It is safe to run twice.

tenjin doctor

Checks the local environment, API reachability, API contracts, skill wiring, session state, wallet state, and balance. Human output includes fix: lines where useful; --json includes the permission recommendation under permissions.

tenjin update

Installs the newest version npm offers this build, pinned to the exact version the registry names.

Flag Effect
--check Report whether a newer version exists without installing.

The manager that owns the install performs it: npm, pnpm, and bun are each driven with their own global-add command. What cannot be driven is refused with the instruction that is correct there, rather than writing a global you never had: a source checkout updates by git, an npx run has nothing installed to replace, a project-local copy updates where it is declared, and yarn is refused because yarn global add exists only in yarn 1. --check answers from all of them.

Deliberately not in the recommended permission allowlist: it replaces the binary your agent then runs. See agent-permissions.md.

The update check

Once a day, at most, the CLI asks npm whether a newer version exists. It never installs on its own; it reports, and you or your agent decide.

Surface Who sees it
One dim stderr line A human at a TTY.
updateAvailable on the JSON envelope Anything reading the envelope, including an agent. Carries current and latest.
A line on hook output A harness reading additionalContext.
{
  "schemaVersion": 1,
  "command": "search",
  "ok": true,
  "data": {},
  "updateAvailable": { "current": "0.1.0-alpha.6", "latest": "0.1.0-alpha.7" },
}

An agent that sees the field can run tenjin update itself, at a moment it chooses. That is deliberate: this CLI starts a fresh process per invocation, so there is no deferred-activation window to hide a binary swap in. "Next start" is "mid-session" for whatever is driving it.

update.mode controls the reporting:

Mode Behavior
nudge Default. All three surfaces above.
off None of them; the CLI stops asking npm entirely.
tenjin config set update.mode off

The field is read from the check's cache, never fetched while your command runs, so it costs no request and no delay.

Search and read

tenjin search "<question>"

Searches public reusable knowledge. The question should be generalized public text, not private project detail.

Flag Values Effect
--max-price <usd> decimal USD Only return candidates at or below this price.
--fresh-within <duration> P<n>[DWMY] Freshness window, such as P30D.
--limit <n> 1 to 10 Maximum candidates.
--applies-to <key=v1,v2> repeatable Applicability filter.

An honest miss exits 0. Use tenjin outcome later so the marketplace learns whether a search helped.

tenjin inspect <url-or-resource-id>

Shows a candidate card and preview before purchase. It never pays.

tenjin read <url-or-resource-id>

Delivers free, local-library, or already-owned pieces. It refuses with exit 3 rather than paying.

Flag Effect
--print-body Include the full body in machine output.
--sections <token-count> Include leading sections within a token budget.

tenjin buy <url-or-resource-id>

Re-checks entitlement and price, then pays through x402.

Flag Effect
--max-price <usd> Hard price cap. Never bypassed by --yes.
--yes Clear the interactive confirmation only.
--print-body Include the full body in machine output.
--sections <token-count> Include leading sections within a token budget.

read and buy are split so a command named read never spends money.

tenjin session start

Mints a read-scoped session key so tenjin read can recover pieces you already own without reopening the wallet each time. It spends nothing, but it does open the keystore.

Flag Values Effect
--scope <scope> read Session scope. This version only supports read.

Paying any x402 endpoint

tenjin pay <url>

The standard x402 client verb, for ANY paid endpoint rather than marketplace pieces: one probe, a 2xx delivers free, a 402 pays (exact scheme, USDC on Base only) under the same spend policy, price cap, and confirm gates as buy, and retries once. When the 402 advertises the standard sign-in-with-x extension, an entitlement re-check runs first with a signature bound to the TARGET origin, so something this wallet already bought re-delivers free. There is deliberately no library and no dedupe: every paid call pays, so always pass --max-price (a hard cap --yes cannot bypass). Flags: -X GET|POST, -d '<json-body>' (implies POST), --max-price <usd>, --yes, --print-body.

The configured base URL is always payable. Any other https origin is the Bazaar lane: it needs the bazaarPay config toggle on AND a configured registry listing whose terms the live 402 does not exceed (checked against the local discover cache first, then live); a mismatch refuses with REGISTRY_MISMATCH before anything is signed, and unreachable registries fail the lane closed. While the toggle is on, the optional tenjin-pay skill is installed beside the others; turning it off removes the skill.

tenjin discover [query]

List (no query) or search the configured x402 discovery registries (bazaarRegistries; defaults to CDP's Bazaar, UltraVioleta, and PayAI's facilitator). Free, keyless, touches no wallet, and works with the toggle off. Listings are settlement-derived and unvetted; registries that did not answer are reported so a partial sweep never reads as a complete one. The sweep is stored (24h) as the pay lane's registry evidence.

Reporting outcomes

tenjin outcome

Reports how a search ended.

Flag Values Effect
--status <status> used, partially_used, rejected, regenerated, purchase_declined Required outcome status.
--search-id <uuid> Search to report against.
--last Target the most recent manual tenjin search.
--resource <uuid> Resource the outcome concerns.
--content-hash <hash> Hash of the exact body read.

Publishing and editing

tenjin publish [file]

Publishes Markdown with optional metadata and a local safety scan. Hard blocks cannot be bypassed.

Flag Effect
--search-id <uuid> Link the piece to the search it answers.
--draft Save privately instead of publishing.
--price <usd> Set the post price.
--excerpt <text> Public preview.
--mode <mode> review, auto, or full-auto for this run.
--yes Clear warning findings and the review confirmation.
--question <text> Question this piece answers. Repeatable.
--task <text> Task this piece supports. Repeatable.
--scope <text> What the piece covers.
--exclusions <text> What it does not cover.
--applies-to <key=v1,v2> Applicability metadata. Repeatable.
--as-of <time> When evidence was gathered.
--valid-until <time> When the answer expires.
--artifact-type <type> document, skill, or dataset.
--temporal-mode <mode> snapshot, maintained, or evergreen.
--provenance <text> How evidence was obtained.
--methodology <text> How it was established.

tenjin edit <post-id>

With no change flag, prints one of your posts and its card. With change flags, merge-updates the post.

It accepts the card flags from publish, plus:

Flag Effect
--title <text> New post title.
--body <path> Replace the body from a Markdown file.
--add-question <text> Append one question. Repeatable.
--add-task <text> Append one task. Repeatable.
--clear <field> Empty one card field. Repeatable.

Wallet and funding

tenjin wallet create

Creates a local Base wallet. The key is stored encrypted under ~/.tenjin/wallet.json; the passphrase comes from TENJIN_WALLET_PASSPHRASE, the OS credential store, or an interactive prompt.

Flag Effect
--replace Archive the existing wallet first, then create a new one.

tenjin wallet show

Prints the wallet address and key source. It never prints the private key.

tenjin wallet balance

Reads the USDC balance on Base.

tenjin fund [amountUsd]

Opens or prints a Coinbase Onramp checkout for this wallet. The payment itself happens in Coinbase.

Flag Effect
--no-open Print the checkout link without opening a browser.
--no-wait Return once the link is issued instead of polling.

tenjin send <amount> usdc <to>

Escape hatch for moving USDC out of the agent wallet. It is deliberately not part of the recommended agent flow.

Flag Effect
--yes Skip the interactive confirm. The configured send cap still applies.

Configuration

tenjin config lists every key with its effective value and source. tenjin config get <key> reads one key. tenjin config set <key> <value> writes one key.

set publish.mode also keeps the harness allowlist in step, since the mode decides whether a publish asks and the allowlist decides whether the harness asks anyway. Moving to auto or full-auto asks once and writes Bash(tenjin publish:*) and Bash(tenjin edit:*) on yes; without a terminal, under --json, or on a no it writes nothing and prints where the rule goes. Moving back to review retracts them without asking. See agent-permissions.md.

Common keys:

Key Default Effect
maxAutoSpend 0 Auto-approve a read up to this amount.
sessionBudget 0 Session auto-spend ceiling; 0 means no ceiling once auto-spend is enabled.
confirm always When to ask before paying.
sendMaxAmount unset Hard per-send cap. Unset means send refuses.
allowlistCreators empty Restrict auto-pay by creator handle.
baseUrl https://tenjin.blog Tenjin API base URL.
rpcUrl https://mainnet.base.org Base RPC endpoint.
evalCohort false Opt into 90-day query retention for retrieval evaluation.
publish.mode review Publish consent mode.
publish.defaultPrice 0.10 Price used when none is given.
hooks.searchMode auto WebSearch and subagent-dispatch hook behavior.
hooks.stopNag on End-of-turn reminder: on, deliberate-only (no web-search batch), off.
hooks.sessionPrimer on Session-start search-first primer: on, off.

MCP

tenjin mcp runs a local stdio MCP server over the same command cores. It exposes search, inspect, buy, outcome, publish, edit, wallet, and fund tools. The wallet stays local, and the same spend and publish gates apply.