Codex Workflow for Research Harness¶
Host-specific: Codex. For the host-agnostic agent entry point (invariants + the three operating scenarios) read
docs/AGENT_OPERATIONS.mdfirst.
Last updated: 2026-05-20
This document turns Codex usage for this repo into a repeatable workflow. It is intentionally conservative: project files may define safe defaults, but user-level secrets and write-capable integrations stay outside the repo.
What changed¶
.codex/config.tomlprovides a project-scoped Codex baseline for the Research Harness MCP server without storing secrets..agents/skillsis a symlink toskills/, so Codex can discover repo-scoped skills from its standard skill path while the repository keepsskills/as the canonical workflow surface.scripts/codex-check.shis the standard local validation entrypoint for Codex-authored workflow/config changes..github/workflows/codex-review.ymlis a manual-only Codex review workflow draft; it does not run on PRs until enabled deliberately.
Daily operating loop¶
- Resume first: call
orchestrator_resume(plustopic_show/decision_log_list) before searching the web or starting a new topic-level workflow. - Use MCP for research primitives: paper search/ingest, claim extraction, gap detection, section drafting, and artifact recording should go through Research Harness MCP tools. Use CLI only for read-only/data-management tasks.
- Record outputs: every durable research output should be recorded with an
orchestrator_record_artifactcall. - Verify before handoff: run
scripts/codex-check.sh --quickfor workflow/config/doc changes; use--fullbefore PRs or broad changes. - Checkpoint early: when a session enters a new phase or context is getting large, write a short checkpoint (current stage, recorded artifacts, open blockers, next action) before opening more files or launching more searches.
- Self-evolve from workspace feedback: when working under
rh-workspace/, human feedback is an absolute trigger for RH self-evolution. Repeated agent-observed failures or unambiguous logic bugs are cautious triggers. Use therh-self-evolutionskill and patch reusable mechanisms inresearch-harness, not only in local Codex skill directories. - Sync Codex after RH updates: after RH skill/workflow changes, run
scripts/sync-rh-to-codex.sh. Installscripts/install-codex-sync-hook.shonce per clone so successful local merges/checkouts/rebases refresh Codex automatically.
Tool routing matrix¶
| Task | Preferred tool/workflow | Avoid |
|---|---|---|
| Resume an existing topic | orchestrator_resume, topic_show, decision_log_list |
Starting with web search |
| Paper search/ingest | Research Harness MCP paper_search / paper_ingest |
Ad hoc paper lists outside the DB |
| Research primitive execution | MCP tools (claim_extract, gap_detect, section_draft, etc.) |
RH CLI primitives that bypass provenance |
| Dependency/API docs | Context7 or official docs | Training-data-only API guesses |
| Current market/tool scans | Exa/web search with source attribution | Uncited recommendations |
| Zotero/local UI verification | Targeted asset tests or Playwright only for local/internal UI work | Visual claims without evidence |
| Cross-file refactors | Serena after local install | Fragile global search/replace |
| PR review automation | Manual Codex review workflow first | Auto-push/auto-merge before trust is established |
Serena pilot¶
Serena is the recommended next tool for semantic code navigation/refactoring. It is not committed as a hard dependency because machines without Serena should still start Codex cleanly.
Install and initialize Serena once per machine:
Manual Codex MCP configuration, if needed in ~/.codex/config.toml:
[mcp_servers.serena]
startup_timeout_sec = 15
command = "serena"
args = ["start-mcp-server", "--project-from-cwd", "--context=codex"]
For this repo, validate the pilot by asking Codex to locate definitions/references across packages/ and skills/ before using Serena for edits.
Verification commands¶
Fast workflow/config validation:
Synchronize RH skills to local Codex:
Install local git hooks that sync after successful local updates:
Full local gate before a PR:
Targeted options:
GitHub Codex review workflow¶
The checked-in .github/workflows/codex-review.yml is intentionally workflow_dispatch only. To use it:
- Add
OPENAI_API_KEYas a GitHub Actions secret. - Trigger the workflow manually with a PR number.
- Inspect the PR comment quality for several runs.
- Only then consider adding pull request triggers.
Sources checked while designing this workflow¶
- OpenAI Codex configuration reference: https://developers.openai.com/codex/config-reference
- OpenAI Codex skills documentation: https://developers.openai.com/codex/skills
- OpenAI Codex GitHub Action: https://github.com/openai/codex-action
- Serena Codex client setup: https://oraios.github.io/serena/02-usage/030_clients.html
- Serena project workflow: https://oraios.github.io/serena/02-usage/040_workflow.html