Keyoku

CLI

The keyoku binary is both the MCP server and the command-line interface. Running it with no arguments serves MCP; the subcommands cover setup, import and export, privacy, goals, approvals, and the audit trail.

Commands

CommandDescription
keyoku [serve]Run the MCP server (the default when no command is given)
keyoku init [--codex]Register the MCP server (Claude Code, plus Codex if ~/.codex exists or --codex is passed) and install the three hooks: PostToolUse, SessionStart, UserPromptSubmit
keyoku statusShow the harness status
keyoku assess <goal>Re-check a goal's criteria
keyoku watch <goal>|--all [--interval s]Watch loop — re-assess one goal or all goals on an interval
keyoku learnMine reusable patterns from your goals + traces (richer with an SLM key; a heuristic floor runs without one)
keyoku backfill [--dry-run]Repopulate hollow learned workflows — lifts the steps from your activity log for goals that converged without recording them
keyoku refine <slug> [--apply]Turn a workflow's raw captured steps into a clean, {{parameterized}} template; --apply saves it runnable via workflow_execute
keyoku inspect [--secrets]Show exactly what's stored in ~/.keyoku (counts, file sizes + permissions, recording state); --secrets scans the activity log for leaks
keyoku recordAppend an ActivityEvent — this is what the PostToolUse hook runs
keyoku briefPrint the session brief — what the SessionStart hook injects (workflows available, unsaved patterns)
keyoku contextPrint prompt-time context — what the UserPromptSubmit hook injects (matching workflows, house patterns)
keyoku import [--dir D] [--codex-dir D] [--limit N]Backfill activity from Claude Code transcripts + Codex rollouts, and ingest CLAUDE.md conventions — kills the cold start; idempotent
keyoku export <slug> [--dir D | --agents-md [file]]Bake a workflow into .claude/skills/<slug>/SKILL.md or an AGENTS.md managed block
keyoku pause / resumePrivacy switch — stop/start all recording and context injection
keyoku doctorVerify hooks, both MCP registrations (Claude + Codex), pause state, activity freshness, SLM tier, and engine reachability
keyoku approvals [approve|deny <id>]List the pending approval queue, or decide a request
keyoku audit [n]Show the append-only audit trail (optionally the last n entries)
keyoku helpShow usage
keyoku versionPrint the version

Environment variables

VariablePurpose
KEYOKU_HOMEState directory. Default: ~/.keyoku
KEYOKU_DEBUGEnable debug logging
KEYOKU_SLM_PROVIDERRefinement provider: gemini | anthropic | openai-compat | none
KEYOKU_SLM_MODELOverride the refinement model
KEYOKU_SLM_BASE_URLAny OpenAI-compatible endpoint — Ollama, LM Studio, LiteLLM, Groq
KEYOKU_SLM_API_KEYKey for the compatible endpoint, if it needs one
GEMINI_API_KEYEnables SLM refinement via Gemini (optional)
ANTHROPIC_API_KEYEnables SLM refinement via Anthropic (optional)
KEYOKU_ENGINE_URLConnect a running keyoku-engine — knowledge mirrors in, queries go semantic
KEYOKU_NUDGE_EVERYProactive nudge cadence — 0 disables nudges

Examples

# First-time setup (then restart Claude Code)
keyoku init

# Backfill months of history — Claude Code + Codex
keyoku import

# Verify hooks, registrations, SLM tier, and engine reachability
keyoku doctor

# Watch all goals, re-assessing on an interval
keyoku watch --all --interval 60

# Review and decide pending connector approvals
keyoku approvals
keyoku approvals approve <id>

# Last 20 audit entries
keyoku audit 20

Related

  • Quickstart — what init changes on your machine
  • MCP Tools — the agent-facing counterparts to these commands