olenji.

Published application 1.1.0 · Versioned documentation · Markdown source

Using Olenji from an existing agent

Olenji supplies speech processing and presentation tools. Your agent decides what to transcribe, how to translate and what to show. It can use the CLI or the stdio MCP server; both address the same local service and durable sessions.

Understand this environment

The passive environment command and tool are available from 1.1.0. Python, npm and direct-download installations expose the same interface at that version.

Start with passive process facts and optional task advice:

olenji environment --json
olenji environment --json --task live_transcription --context '{"host_relation":"remote","audio_access":"unavailable","presentation":"text"}'

The matching MCP tool is olenji_environment, with optional task and context arguments. Startup discovery supplies short advisory guidance; the full workflow remains available through the olenji://agent-guide resource when needed. Tasks are inspect (the default), live_transcription, file_transcription and text_translation. Context accepts only these optional fields:

Field Values Meaning
host_relation unknown, same_device, remote The agent's stated relationship between the process host and the user's audio computer.
audio_access unknown, available, unavailable Whether the agent states that the requested audio source is accessible.
file_access unknown, available, unavailable Whether the agent states that the requested input file is accessible.
presentation unknown, browser, artifact, text The agent's stated output route for this task.

Omitted context stays unknown. Context is a declaration, not a tested permission or a command to the agent. Product names, a desktop label, environment hints and an installed package do not prove access to the user's files, microphone or browser. Process facts describe the process answering the request; they do not identify the user’s computer or the LLM's execution host. doctor separately describes the running service and performs heavier readiness discovery.

The environment report is advisory. The user's request and the host agent's permissions govern the work; Olenji does not replace them. The standalone CLI path creates no workspace or credentials and starts no service. The MCP tool performs no service request, model/device probe, network operation, recording, job, download or browser launch; starting mcp serve still uses its existing workspace setup. The report does not establish inference readiness, granted audio permission, active capture, file readability or visible presentation.

Capability discovery also labels capture evidence as service-host adapter/prerequisite availability, with permission and audio flow not checked and the user-device relationship unknown. Existing source available booleans retain that limited meaning.

Use the report to choose the shortest supported route:

Missing or unknown access calls for a targeted check or a concise next step, not an automatic platform switch. A connected agent with working access should complete the requested task. Before saying capture is active or a view is shown, inspect the actual session and view state.

Inspect each model's inference_options before selecting device, precision, thread count or native backend. File/live/refinement tools accept the same typed inference object; see INFERENCE_OPTIONS.md for inheritance, explicit reset, requested-option provenance and hardware availability.

Connect

{
  "mcpServers": {
    "olenji": {
      "command": "olenji",
      "args": ["mcp", "serve"]
    }
  }
}

For a separate workspace, put "--data-dir", "/absolute/workspace/path" before "mcp", "serve". CLI commands accept --json; event following also supports --jsonl. Status belongs on stderr and structured responses on stdout. Use olenji schema --json or the MCP tool definitions to discover current argument shapes.

Version 1.1.0 exposes 42 tools, including the passive environment tool, and supports modern MCP 2026-07-28 discovery/per-request metadata as well as legacy initialization for 2025-11-25 and earlier listed versions. Operations that need a workspace service use the authenticated local HTTP interface; the service's SSE feed is an application event feed, not a separate MCP transport. Long-running tool calls return explicit job IDs, so closing stdio does not own a recording's lifetime.

MCP tools also cover session configuration, refinement, model verification/removal, source history/split/merge, speaker creation/merging, provider configuration and view detachment. olenji_session reads metadata and counts without loading all transcript tracks. Use olenji_segments and olenji_events for bounded source reads. olenji_session_window includes the connected translation groups and speaker context needed to continue translating or reviewing an existing session.

Example user instructions

First-use sequence

  1. Read the environment advice and, when the task needs audio processing, capabilities and selected-model readiness. Preserve exact model IDs; do not silently substitute a model just because it is more convenient.
  2. Plan the requested installation. Report platform constraints, model rights and unavailable artifacts from the returned state. Install requested compatible models and wait for their jobs when needed.
  3. When requested, start transcription or capture with explicit language, source, speaker-attribution and retention choices. Keep the returned session and job IDs. Text-only work can use supplied source and translations without capture.
  4. Read a bounded snapshot or event page. Persist the cursor and follow committed updates; transient draft text can change.
  5. Open a view only when the user's request calls for one. Send declarative view settings and compare desired and applied revisions.
  6. Produce a requested translation or annotation using the exact source IDs and revisions. Export when the user requests a file.
olenji doctor --json
olenji models list --json
olenji models plan-install fluid-speech.mini.onnx --json
olenji models install fluid-speech.mini.onnx --json
olenji transcribe /absolute/path/interview.mp4 \
  --model fluid-speech.mini.onnx --retain-audio --no-wait --json
olenji jobs wait JOB_ID --json
olenji sessions window SESSION_ID --query \
  '{"limit":50,"target_language":"tr","committed_only":true}' --json

Speaker attribution also needs diarization.wespeaker.en. Install it and add --diarize when starting a new transcription/capture. Speaker IDs represent recurring acoustic voices; assign names only from user-provided context. Preserve unknown attribution where the model cannot confidently cluster a turn.

CLI and MCP file imports resolve relative paths from the calling process's working directory before contacting the service. The service may have been started from a different project. Absolute paths remain useful when an agent changes working directories between operations; the original file is never moved by import.

Omitted options inherit saved preferences. Supply --no-retain-audio to explicitly prevent audio retention even if the workspace preference enables it. The API equivalent is "retain_audio": false; omission or null inherits the preference. Recognition "auto" remains an explicit choice. Multi-file CLI retries with one idempotency key derive stable per-file keys; repeat the same path order and arguments to retrieve the same jobs.

Live capture and views

olenji live sources --json
olenji live start --source mic --model faster-whisper.tiny --diarize --json
olenji ui open SESSION_ID --layout bilingual --translation tr --json
olenji events SESSION_ID --after 0 --committed-only --limit 100 --json
olenji ui configure VIEW_ID --config \
  '{"layout":"bilingual","target_language":"tr","typography":{"translation_scale":1.5},"filter":{"recent_speakers":{"count":2}},"follow":"live"}' --json
olenji ui status VIEW_ID --json

Native microphone/system capture is owned by the service and can survive a viewer closing. Browser capture needs the paired tab to grant microphone permission and supply audio. A session awaiting a browser is not proof that recording has begun. Inspect capture_status and capture_connected before reporting that audio is flowing.

The optional terminal view is olenji tui SESSION_ID. Browser layouts are conversation, bilingual, captions, review, timeline and operations. View control accepts a fixed schema, not arbitrary HTML or JavaScript. A requested configuration and a rendered configuration have different revisions until a viewer acknowledges them.

Translate with the same agent

Read committed source and existing translation context, translate their meaning, and submit a translation track. Use BCP 47 language tags such as tr for Turkish. One translation can refer to several source segments, but each reference must match the current revision.

For a live or resumed translation workflow, call olenji_session_window with a bounded query:

{
  "session_id": "SESSION_ID",
  "limit": 50,
  "target_language": "tr",
  "committed_only": true
}

Omitting offset selects the latest turns. The response's window_ids identifies the requested turns; segments may also contain source context outside that window because a translation covers several turns. Read that complete context before updating a group. translations retains connected current and stale records, including human corrections, so a new agent can inspect prior work without exporting the whole session. Each source row carries its current revision; a stale translation can still reference an older one. Do not treat those old references as current source revisions or assume an extra context row is another visible turn.

The CLI equivalent is olenji sessions window SESSION_ID --query '{"limit":50,"target_language":"tr","committed_only":true}' --json. --query @query.json reads a JSON file; --query - reads the same object from stdin. These interfaces use the existing bounded window contract, including grouped ownership, cursor consistency, search and size limits. WINDOW_TOO_COMPLEX asks the caller to reduce the window or deliberately export the complete record; it never silently truncates a translation group.

{
  "translations": [{
    "source_refs": [
      {"segment_id": "SEGMENT_ID", "revision": 1}
    ],
    "target_language": "tr",
    "text": "Bugün üzerinde çalıştığımız konuyu açıklayayım.",
    "producer": {"kind": "external_agent", "name": "your-agent"}
  }]
}
olenji translations put SESSION_ID --file translation.json --json
olenji export SESSION_ID --format vtt --language bilingual --to tr --out subtitles.vtt

Keep the source transcript unchanged unless correcting it is part of the request. If the source changes, read the latest revision and regenerate the affected translation. Stale translations remain inspectable but are omitted from readable exports. Do not overwrite a human translation correction through automatic translation.

Alternatively, configure a local OpenAI-compatible provider and enable auto_translate on the session. Olenji coalesces new turns and uses that provider without requiring repeated agent calls. Remote providers require the session to explicitly allow cloud processing. This setting governs Olenji's provider requests; the external agent has its own data-processing boundary.

The local_only value from doctor is the workspace default, not proof of a selected session's current policy. Inspect that session before changing provider processing or claiming that its text stays local.

Committed source appended through olenji_add_segment also wakes enabled automatic translation. You may append the next turn while translation is running; capture and refinement retain their source-writing ownership. This allows an agent to supply a growing transcript without using unrelated preference edits as wakeups.

Read session.metadata.translation_automation through olenji_session or olenji sessions get SESSION_ID --json before deciding whether to intervene. pending and retry_wait already have a service owner; retries need no extra source or repeated command. The marker includes the next UTC deadline and owning job_id when admitted. A relevant provider repair or an explicit sessions configure ... --metadata '{"auto_translate":true}' resumes blocked automatic work. Tags and other unrelated edits do not reset its bounded retry budget. A manual translate command is an independent one-off request.

Use the owning job ID to cancel that automatic generation, including a deferred retry whose earlier attempt has already failed. Its historical job result remains historical; inspect the marker for the cancelled continuation. Set auto_translate:false to disable future automatic generations as well. Service restart resumes only previously marked unfinished work that is still enabled; it does not revive cancelled requests, sweep legacy transcripts into a provider, or restart capture. See translation recovery for exact states and races.

Retries, edits and recovery

For a stable multi-page transcript read, request the first page and retain its cursor. Send that value as expected_cursor on subsequent olenji_segments calls, or use the CLI:

olenji segments list SESSION_ID --limit 100 --json
olenji segments list SESSION_ID --limit 100 --offset 100 --expected-cursor CURSOR --json

Use the response's next_offset, not an independently computed offset; null means completion. If selected-session content changed after the first page, the service returns retryable SNAPSHOT_CHANGED with HTTP 409. Restart the read instead of joining inconsistent pages. Changes in an unrelated session do not invalidate this read.

The same cursor rule applies to olenji_session_window and sessions window: begin with offset:0 when traversing from the first turn, then send the response's next_offset and initial cursor as expected_cursor for each later page. For repeated reads of one unchanged window, after can return {unchanged:true,cursor}. Reuse after only with the same query; changing the language, filter, offset or limit requires a fresh read. A translation spanning two pages remains one group with the same source references, so do not count it as two independent sentences.

HTTP readers can use GET /api/sessions/SESSION_ID?after=CURSOR to receive {unchanged:true,cursor} when transcript content is unchanged. Metadata/status queries and views remain separate. GET /api/sessions/SESSION_ID/tail?limit=15&target_language=tr supplies recent turns plus the complete source/translation groups needed to respect revisions and human ownership; render tail_ids and use the additional source context for validation. It is the endpoint used by the terminal view.

An event checkpoint can become invalid after restoring a database. Polling returns reset:true; SSE sends a reset frame, and CLI events --follow emits a noncommitted stream.reset record with requires_snapshot:true. Discard the stale checkpoint, read a new snapshot and resume at its cursor. A segments.replacement_started event means a refinement, turn merge or speaker merge committed as a unit: refresh its complete snapshot before applying constituent events, so readers do not temporarily display both replaced and replacement text.

jobs wait --wait-timeout SECONDS and events --follow --seconds SECONDS begin their observation budget after the initial service connection/startup. Later polls never start a replacement daemon. WAIT_TIMEOUT reports the same durable job_id; it does not cancel work. If the service disappears, inspect its status and deliberately restart it before resuming. A follow error includes the last consumed cursor and selected session_id; replay from that cursor after checking for recovery/reset. Event follow ends without a final document when its requested duration expires. Observer responses are limited to 8 MiB: use a smaller event --limit, a bounded session window, or export if a response is too large. View waits retain applied:false on expiry, so an agent must not describe an unacknowledged presentation as visible.

The browser defers an incoming view change while the user is pressing an action or has an open dialog. A note opened on the current session stays attached to that session through save, even if you request another session. Let the user finish or cancel the draft; inspect the existing view's applied revision rather than opening repeated replacement views. Acknowledgement follows the actual render. Explicit detachment still takes effect.

Translation language identity is case-insensitive (TR and tr refer to the same track). Newly written language tags use consistent casing. Existing human corrections cannot be bypassed by changing case, grouping or legacy producer representation.

olenji models parity --json distinguishes catalog coverage, installation, runtime readiness and actual inference validation. Never describe a gated model or an untested native platform as validated solely because a catalog entry exists.

Long exports

Prefer olenji_export with a destination for long sessions. The CLI equivalent is olenji export SESSION_ID --format jsonl --out transcript.jsonl. Files are streamed and atomically published: interrupted transfers leave an existing destination intact. Without a destination, MCP refuses results over 200,000 bytes while keeping its receive buffer bounded.

Each export is one consistent committed snapshot. Recording and editing can continue, and the download's X-Olenji-Cursor identifies what it contains. JSON/JSONL preserve the full original tracks and provenance; readable formats apply source/translation selection and omit stale text from display. All seven formats avoid constructing the whole transcript in server memory.

Browser integrations can POST /api/sessions/SESSION_ID/export/prepare with format/language query parameters, then navigate a native download link to the returned root-relative download_url. Authenticate with the already paired cookie or bearer credential; never put the API token into a URL. Links are single-use, expire after five minutes, and are revoked on session deletion. EXPORT_BUSY asks the caller to finish a pending download or retry later.

Language defaults for bounded reads

olenji_session_window and sessions window use the SessionWindow schema, whose omitted target_language defaults to tr. Supply the desired language explicitly when continuing another track. The HTTP /tail projection also defaults to tr; the TUI first resolves its saved default and passes it explicitly. Translation jobs, exports and new views retain their documented workspace-preference behavior.