OKLMdocumentation v1.0.3
On this page

Commands design

How commands_spec.md maps onto OKLM. What exists, with evidence, is the "Commands" section of gap-analysis.md: two REPLs with a handful of string comparisons, no framework.

Status: C1 to C3 done (the agent spec's M10, agent-ui.md). Taken at C1: the menu is drawn under the prompt by the terminal view, the line editor telling Up / Down to it; oklm chat keeps its own four commands for now (roadmap, Later); no command skipped; /voice later.

Framework

§ Existing New code
1.1, 1.2 Types and registry cmd_agent, cmd_chat include/oklm/harness/commands.h, src/harness/commands.c: one registry of commands (name, aliases, type, arguments, source, availability, behavior while busy, headless text), filled by the built-ins, the prompt commands and later MCP prompts. The REPLs dispatch through it; oklm chat registers its own set (/system, /tool) in the same registry.
1.3 Parsing In commands.c, with its own test: commands only at the start, case-insensitive names, : namespaces, arguments, $ARGUMENTS / $1, // escape, unknown commands answered with suggestions and never sent to the model.
1.4 Precedence tools.c skills Built-in, then project, user, plugin, MCP; shadowing reported.
1.5 While busy view_key, view.typed Commands typed while the model writes: queued with an indicator, or run at once for the ones marked immediate (/thinking, /tasks).
1.6 Menu line_edit.c A completion hook in the line editor (Tab and /), the menu drawn below the prompt by the terminal view.
1.7 Prompt commands tools.c skill_header, scan_skills Skills and .oklm/commands/**/*.md read by the same loader; the front matter's other keys; expansion of ! commands (through the Bash permission path) and @ files.
1.9 Headless cmd_agent -p -p "/cmd" runs the command; dialogs answer in text.
2 Shared UI agent_ask, view_status A picker, a confirmation with "don't ask again", a progress view, text fallbacks, in a terminal module once apps/oklm.c's view grows (shared with the agent specification's terminal work).

Catalog

Each command calls into the specification that owns its behavior; this one owns only the dispatch, the menu and the shared UI. Existing commands are kept: /reset becomes /clear's alias, /jobs /tasks's (per agent-design.md); /mode MODE and /thinking stay as OKLM built-ins.

Decisions to take before C1

  1. oklm chat. Proposed: it shares the registry with its own set.
  2. The menu's place. Proposed: below the prompt, drawn by the line editor's view.
  3. Commands to skip beyond the spec's Skip rows: none proposed.
  4. /voice. Proposed: later, once recording exists (OKLM's Whisper transcribes already).

Order

C1 to C3 need nothing but what exists (skills, the line editor); they can start right after the agent specification's M1. The others follow the milestones of the commands' owners.