-
Notifications
You must be signed in to change notification settings - Fork 0
How it works
When you run omnicode, the npm-managed src/bin/omnicode.js entrypoint:
- Verifies that
opencodeandomnirouteare onPATH; exits with an error if either is missing. - Resolves the session launch mode (see Session resolution).
- Calls the Node.js runtime module (
src/bin/omnicode-runtime.js) directly — no bash intermediary.
The Node.js runtime then:
- Runs GrayMatter initialization quietly (output captured to
~/.local/share/omnicode/graymatter-init.log). - Runs OpenSpec initialization quietly (output captured to
~/.local/share/omnicode/openspec-init.log). - Starts or reuses
omniroute --no-openin the background. - Launches OpenCode with the resolved session argument.
- Cleans up the OmniRoute process it started on exit.
OmniRoute is started as a detached Node.js child process with stdout/stderr piped to ~/.local/share/omnicode/omniroute.log.
- Logs and PID files live under
~/.local/share/omnicode. - If OmniRoute is already running, the existing process is reused.
- Only the OmniRoute process started by
omnicodeis stopped when OpenCode exits and no other OpenCode process remains.
omnicode does not invent or persist session IDs. OpenCode manages its own sessions. The launch mode is resolved as follows:
- If you pass
-s <session_id>,omnicodelaunchesopencode -s <session_id>directly. OpenCode will report an error if that session does not exist. - If you pass
-cor pass nothing and at least one OpenCode session exists for the current directory,omnicodereads the latest session ID from OpenCode's SQLite database and launchesopencode -s <latest_session_id>. - If you pass nothing and no session exists,
omnicodelaunchesopencodeso a new session is created.
Session IDs are read from ~/.local/share/opencode/opencode.db, filtered by the current directory, and ordered by time_updated. omnicode -c intentionally overrides OpenCode's native -c behavior to avoid the internal OpenCode dummy session ID error.
GrayMatter and OpenSpec initialization output is captured to log files instead of printed to the terminal:
| Log file | Contents |
|---|---|
~/.local/share/omnicode/graymatter-init.log |
GrayMatter init output |
~/.local/share/omnicode/openspec-init.log |
OpenSpec init output |
omnicode prints concise status lines during startup instead of showing the full output of these tools.