OMX
Oh My CodeXv0.14.0

Context Hooks

Hooks that inject project memory, directives, reminders, and notepad content into Codex prompts via system-reminder tags.

Context hooks are the subset of OMX hooks responsible for enriching the next prompt with structured knowledge. Rather than modifying the user's message, they emit <system-reminder> tags that Codex reads as injected context. This keeps user messages clean while ensuring the model always sees current project memory, active directives, and notepad entries.

What it is

When a context hook fires it reads one or more knowledge sources — .omx/state/, the wiki at .omx/wiki/, project memory, or the notepad — and formats the relevant content as a <system-reminder> block appended to the prompt context. The model sees this content as authoritative background, not as a user instruction, which makes it suitable for persistent facts, constraints, and reminders that should influence every turn.

Sources injected

  • Project memory — Key facts and directives written by project_memory_write or project_memory_add_directive. Injected on SessionStart and selectively on subsequent turns when directives are active.
  • Session reminders — Short-lived notes written via notepad_write_working or notepad_write_priority. Injected until they expire or are pruned.
  • Wiki summary — A compact excerpt from .omx/wiki/ surfaced on SessionStart when wiki pages exist. Write-heavy operations (ingest, rebuild) are deferred to avoid blocking the hook path.
  • Mode state — When an active workflow mode is detected (ralph, team, ultrawork), its current phase and continuation instructions are included so the model resumes from the right point.

Example

Inject a permanent directive that all commits must include a trailer:

omx memory add-directive "All git commits must include Co-authored-by: OmX <omx@oh-my-codex.dev>"

The next session start will surface this directive in a <system-reminder> block automatically.

Read what is currently in the notepad:

cat .omx/notepad.md
Was this page helpful?

On this page