Skip to content

omp as a third engine: the map's Ask bar works under Oh My Pi - #159

Open
chappie-daemon wants to merge 1 commit into
haydenschmitty:mainfrom
chappie-daemon:feat/omp-engine
Open

chappie-daemon wants to merge 1 commit into
haydenschmitty:mainfrom
chappie-daemon:feat/omp-engine

Conversation

@chappie-daemon

Copy link
Copy Markdown

What this adds

omp (Oh My Pi, https://omp.sh) as a third engine beside the Claude Code CLI and Codex, so a map built in omp can answer questions on itself.

A floorplan built under omp was already complete: omp reads the skill's ${CLAUDE_SKILL_DIR} and $ARGUMENTS the way this skill uses them, and the whole scan → architecture → describe → build pipeline ran unaided (measured on a two-file Express app: full map in 34 s, print mode, no manual step). What did not work was the map's Ask bar: serve.mjs knew only claude and codex, so the map opened with

ASK  needs the Claude Code CLI, which was not found; the map itself works

What changed

  • Detection (scripts/lib/agent.mjs): omp is recognised from the variables it sets for every command it runs — OMPCODE, or PI_SESSION_ID — and gets a label in cliLabel. A map built under omp records meta.agent: "omp" and leaves the project notes alone, as Codex's does.
  • Engine (assets/serve.mjs): omp -p --mode=json with read-only tools only (read, grep, glob), --no-session so nothing lands in the person's history, and --no-skills --no-rules --no-extensions --no-context-files so each question does not drag a project's CLAUDE.md and every installed skill along with it. The line-delimited JSON stream (message_end, turn_end, agent_end) is read the way the other two are; follow-ups carry the last few turns as Codex's do, because an ephemeral run has no session to resume.
  • Nested session hygiene: cliEnv() now also strips OMPCODE and PI_SESSION_ID / PI_SESSION_FILE / PI_TOOL_CALL_ID / PI_TERMINAL_OWNER_PID, the way it already stripped the Claude Code and Codex ones.
  • open.mjs: --engine omp, --omp <path>, and a name/site for the "not installed" line.
  • Docs: README install section, and a CHANGELOG entry under Unreleased.

One honest limit: omp has no output-schema flag (claude has --json-schema, codex has --output-schema), so the entry is structured: false and the map offers Ask and not Change under it. Change edits plan.json from the map and needs the answer held to a schema; pretending otherwise would show a button that quietly fails. If omp grows a schema flag, flipping that one field is the whole change.

Tests

tests/fixtures/fake-cli/fake-omp.mjs stands in for the CLI the way the Codex and Claude fixtures do: it answers --version, logs what it was given to $FAKE_LOG, and prints the JSON event stream a real omp -p --mode=json run emits — including the preamble-then-answer shape that a turn_end-only reading gets wrong.

  • tests/agents.test.mjs: detection by OMPCODE and PI_SESSION_ID, the label, and a map built with --agent omp recording it and leaving CLAUDE.local.md alone.
  • tests/ask.test.mjs: with only omp installed the engine is omp and change is false; the arguments are print mode, --no-session, --tools read,grep,glob, no context files and no skills, --cwd at the codebase root; the answer parses to its title and item refs; a follow-up carries the earlier question; an unreachable model reports a failure rather than an empty answer.

node --test tests/agents.test.mjs tests/ask.test.mjs → 19 pass, 1 skipped (the existing Windows-only case), 0 fail.

Why I think it belongs here rather than in omp

agent.mjs says "Adding an agent is an entry here", and everything omp-specific is local: one ENGINES entry, one runner, one DETECT line, one flag pair. The alternative — omp shimming a claude command — would make the map label its answers with a program that is not Claude Code, which is the case #95 was about.

…d Codex

A floorplan built under omp (Oh My Pi) was complete — omp reads the skill's
${CLAUDE_SKILL_DIR} and $ARGUMENTS the way it uses them — but serve.mjs only
knew the Claude Code CLI and Codex, so the map opened saying its Ask bar needed
a CLI that was not installed.

omp is detected from the variables it sets for every command it runs (OMPCODE,
PI_SESSION_ID), recorded on the map like the other two, found on PATH, and asked
through `omp -p --mode=json` with read-only tools, no session written, and no
skills, rules or project context loaded into each question. Follow-ups carry the
last few turns, the way Codex's do. omp has no output-schema flag, so the map
offers Ask and not Change under it.

Tests: a fake omp emitting the real event stream, plus cases for detection, the
recorded agent, the read-only argument shape, follow-ups and an unreachable
model.
@chappie-daemon

Copy link
Copy Markdown
Author

One note on the full suite for whoever runs CI against this branch: node --test here gives 493 tests, 489 pass, 3 fail, 1 skipped, and all three failures are the wall-clock budget tests — C# files built to make pattern matching slow are read quickly, files of unclosed lists and brackets are still read quickly, and Liquid files built to make pattern matching slow are read quickly. They assert a read takes under a couple of seconds and the machine running this was heavily loaded (several agents and their subagents at once). The same three are the only ones that failed on the untouched tree before this branch's change, so I am confident they are load-sensitive rather than related — but I could not get a quiet machine to prove it, so I am saying so rather than claiming green.

Everything this branch touches passes on its own: node --test tests/agents.test.mjs tests/ask.test.mjs → 19 pass, 1 skipped (the existing Windows-only case), 0 fail.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant