omp packages

@chronova/omp-comment-checker1.3.6

Comment checker hook extension for oh-my-pi (omp). Runs @code-yeongyu/comment-checker after write, edit, multiedit, apply_patch, hashline, patch, and replace, then self-heals via omp's session_compact + TUI notifications.

niklas.schaeffer Published 1 month ago MIT ~156 downloads/mo

Built for omp

The author tagged this package oh-my-pi.

Did it work for you?

Result

One report per person. A new report replaces your old one.

Reports 0

No reports yet.

Readme

omp-comment-checker — Self-Healing Comment Verification Hook for oh-my-pi

omp-comment-checker

npm version CI Release license: MIT

Comment checker hook for oh-my-pi (omp) and the upstream pi coding agent. Forked from code-yeongyu/pi-comment-checker v0.1.0 and retargeted at the omp extension API.

Runs @code-yeongyu/comment-checker before and after every mutation tool, surfaces the warning back into the tool result so the agent must react, and self-heals the warning across the next session compaction so the LLM sees it again on the next turn.

Why this fork

Pi and omp share the same extension shape, but omp ships two extra capabilities this checker uses to recover from comment-detected output:

Capability What the checker does with it
pi.appendEntry(customType, data) Persists each unfired warning to the session file.
pi.sendMessage(content, options) Re-injects unresolved warnings as a custom message on session_compact.

The fork detects the host at load time. If appendEntry / sendMessage are absent (plain pi), the self-heal loop is a no-op and behavior matches upstream 0.1.0 exactly.

Behavior

Case Result
write / edit called (pre-exec) blocks the call when the checker flags the proposed content; the LLM sees an explicit rejection reason that names the blocked tool, the file path, states the file was NOT modified, includes the checker warning, and shows the skipCommentCheck: true override hint
write succeeds checks the written content
edit succeeds checks oldString / newString
multiedit succeeds checks the complete edits payload
apply_patch succeeds with OMO metadata checks each metadata file using before / after, skips deletes
apply_patch succeeds without metadata falls back to raw Codex patch parsing
omp edit tool (any mode: hashline / patch / replace / apply_patch) reads details.perFileResults for oldText / newText per affected file
checker exits 2 (post-exec) appends the warning message to the tool result, marks the result isError: true, and fires the self-heal path
checker binary missing leaves tool output unchanged, no self-heal, pre-exec passes through
checker exits unexpectedly leaves tool output unchanged, no self-heal

Self-heal flow

1. Mutation tool (write / edit / multiedit / apply_patch) is about to run.
2. omp-comment-checker inspects the proposed content, runs the
   @code-yeongyu/comment-checker binary, exit code 2.
3. If the binary flags the content, return `{ block: true, reason }` so
   the host aborts the tool call before the file is written. The
   `reason` explicitly names the blocked tool, the file path, states
   that the file was NOT modified, includes the checker warning, and
   ends with `To override for this call, re-run the tool with
   skipCommentCheck: true in its input.` so the LLM can self-correct on
   the next turn.
4. If the binary passes, let the tool run. On the matching tool_result,
   re-run the checker against the post-mutation content for modes we
   could not pre-check (apply_patch, hashline). Append the warning to
   the existing tool result content AND mark isError:true so the LLM
   treats the result as a failed tool call.
5. Persist each warning via pi.appendEntry("omp-comment-checker:warning", …).
6. On the next session_compact event, re-inject any unfired warnings
   via pi.sendMessage(...) so the LLM sees them again as fresh
   context. The store is cleared on session_start.

The session_compact listener only fires under omp. Under plain pi, the listener registration is skipped and the store is local-only. Per-call overrides: pass skipCommentCheck: true in the tool input to opt out of the comment check for that call. The flag is honored by both the pre-exec (tool_call) and post-exec (tool_result) handlers; the post-exec path also skips the check when the tool result already looks like a failure.

Installation

The package targets both the omp extension loader and the upstream pi extension loader.

# 1. From npm
omp install npm:@chronova/omp-comment-checker
pi  install npm:@chronova/omp-comment-checker

# 2. From git
omp install git:github:nx-solutions-ug/omp-comment-checker
pi  install git:github:nx-solutions-ug/omp-comment-checker

# 3. omp settings.json (~/.omp/settings.json)
{
  "packages": [
    "git:github:nx-solutions-ug/omp-comment-checker"
  ]
}

# 4. Dev / one-shot test
omp -e /path/to/omp-comment-checker/src/index.ts
pi  -e /path/to/omp-comment-checker/src/index.ts

After installation, restart the agent or run /reload inside an interactive session.

Command

/omp-comment-checker

Shows binary availability, the current warning count, and the list of unfired warnings. If the binary is missing, the command prints setup guidance.

Development

npm install
npm test
npm run typecheck
npm run check
npm pack --dry-run
omp -e ./src/index.ts
pi  -e ./src/index.ts

Origin

Ported from code-yeongyu/pi-comment-checker v0.1.0 and adapted to the public oh-my-pi extension API. Upstream checker behavior is preserved; the fork adds the omp self-heal loop and the omp edit-tool details.perFileResults extraction path.

License

MIT.

Related

Acknowledgements

  • Mario Zechner (@badlogic) — author of pi-mono and the pi-coding-agent extension API.
  • Can Bölük (@can1357) — author of oh-my-pi and the self-heal / session_compact contract this fork uses.
  • Yeongyu Kim (@code-yeongyu) — author of the upstream extension and the comment-checker binary.