Skip to content

docs(skill): add the repo-owned ocx operating skill - #2788

Merged
lidge-jun merged 5 commits into
devfrom
codex/ocx-agent-skill
Aug 28, 2026
Merged

lidge-jun merged 5 commits into
devfrom
codex/ocx-agent-skill

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Aug 27, 2026 •

Copy link
Copy Markdown
Owner

Summary

Every prior phase in this stack widened what an agent can do with ocx. This one makes it
discoverable without reading source, by adding a repo-owned operating skill.

skills/ocx/SKILL.md                        orientation, exit codes, consent, routing
skills/ocx/references/01_management_surface.md   GENERATED from src/cli/capabilities.ts
skills/ocx/references/02_json_shapes.md          envelopes and which field to read
skills/ocx/references/03_recipes.md              eight verified task sequences
skills/ocx/references/04_failure_semantics.md    exit codes, 503 classes, retry policy

Repo-owned rather than in $CODEX_HOME/skills, because it describes this repository's CLI
contract and has to version with it.

The surface map is generated, and a test enforces it

01_management_surface.md is rendered from the capability table by
scripts/generate-ocx-skill-surface.ts. tests/skill-ocx.test.ts asserts the committed file matches
regeneration byte for byte, and CI runs bun run skill:surface:check as a named step so the failure
tells you the fix instead of showing a byte diff.

Hand-writing it would recreate the defect this whole stack removed: a second description of the CLI
surface, free to drift from the first.

Driven red both ways — adding a comment to a capability leaves the check green (renders no output),
changing one summary string fails it.

The command-existence gate found a real error

One test extracts every ocx <command> presented as a command across all five pages and asserts each
exists in CLI_COMMANDS. It immediately failed on ocx request-history — a command the design
doc's recipe section named and which does not exist. The route-decision view is
ocx logs explain <request-id>.

Checking the rest against source found three more wrong shapes:

Documented Actual
access key add --label X access key create <name> (positional)
access key remove --id X access key remove <id> --yes (positional)
provider default X provider set-default X

A skill documenting a command nobody can run is worse than no skill: an agent tries it, gets
Unknown command, and concludes the tool is broken.

The extractor needed a second pass. Scanning raw prose flagged "driving ocx programmatically" and
the sentence "there is no ocx request-history command" — a line whose entire purpose is to say the
command does not exist. It now reads only code spans and fenced blocks, skipping negated lines, and a
companion test asserts it still finds eight real commands so narrowing it could not make the main
assertion vacuous.

Recipes were executed, not transcribed

ready, status, logs --jsonl, logs explain, access key list, storage report,
storage cleanup --percent 1, inspect star, inspect pacing, inspect client-config,
integration native list, and agent request-user-input were all run against a live proxy, and the
field names in 02_json_shapes.md were read off those responses.

Consent

SKILL.md states plainly not to star the repository on the user's behalf, and names the workarounds
it forbids — gh, a raw HTTP call, a minted session. Three tests hold that line, including one that
fails if any page contains gh api. The failure mode being guarded is a skill that mentions a
boundary and then supplies the workaround anyway.

Docs-site

reference/cli.md gains the exact exit-code table (0/2/4/5/1), the preview-first rule for
storage cleanup, an agent-orientation section, and a behavior-change list for this stack:
doctor/sync-cache exiting non-zero, 404→4 and 409→5, position-independent --json,
logs --model actually filtering, and ocx storage gaining subcommands with its bare form unchanged.

Changes are additive, so the seven translated locales are less complete but do not contradict the
English source.

Verification

bun test tests/skill-ocx.test.ts tests/repo-hygiene.test.ts tests/cli-capabilities.test.ts \
  tests/cli-registry.test.ts
→ 43 pass, 0 fail, 302 expect() calls

bun run skill:surface:check      → current
./node_modules/.bin/tsc --noEmit → clean
bun run privacy:scan             → passed

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • New Features

    • Added comprehensive ocx CLI skill documentation, including command discovery, JSON output, recipes, safety guidance, and failure handling.
    • Added CLI reference updates covering exit codes, agent-driven workflows, preview behavior, and recent command changes.
    • Added automated generation and validation for the documented CLI capability surface.
  • Bug Fixes

    • Corrected documentation and validation for supported storage inspection commands.
  • Documentation

    • Added implementation records and contributor guidance for maintaining the ocx skill documentation.

@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner August 27, 2026 20:06
@coderabbitai

coderabbitai Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 4fca846b-79a6-4271-b189-1ff55e7e20a0

📥 Commits

Reviewing files that changed from the base of the PR and between 3b8a6ae and 04fcbc3.

📒 Files selected for processing (14)
  • .github/workflows/ci.yml
  • AGENTS.md
  • devlog/_plan/260828_ocx_agentic_control/071_wp8_implementation_record.md
  • devlog/_plan/260828_ocx_agentic_control/081_wp9_implementation_record.md
  • docs-site/src/content/docs/reference/cli.md
  • package.json
  • scripts/generate-ocx-skill-surface.ts
  • skills/ocx/SKILL.md
  • skills/ocx/references/01_management_surface.md
  • skills/ocx/references/02_json_shapes.md
  • skills/ocx/references/03_recipes.md
  • skills/ocx/references/04_failure_semantics.md
  • tests/cli-storage-inspect.test.ts
  • tests/skill-ocx.test.ts

📝 Walkthrough

Walkthrough

Adds a repo-owned ocx agent skill with generated capability documentation, JSON and failure references, command recipes, validation tests, CI freshness checks, CLI guidance, and implementation records.

Changes

OCX skill contract and generated surface

Layer / File(s) Summary
Skill contract, references, generator, and validation
package.json, scripts/generate-ocx-skill-surface.ts, skills/ocx/*, tests/skill-ocx.test.ts
Adds the OCX skill, four reference pages, a capability-surface generator, generation scripts, and tests for file structure, generated-content drift, command existence, and consent boundaries.

CLI reference and repository integration

Layer / File(s) Summary
CLI behavior and agent guidance
docs-site/src/content/docs/reference/cli.md
Documents exit codes, preview-only behavior, agent command discovery, and recent CLI behavior changes.
CI and storage validation
.github/workflows/ci.yml, tests/cli-storage-inspect.test.ts
Adds a named CI freshness check and verifies the codex-logs status storage route.
Repository guidance and implementation records
AGENTS.md, devlog/_plan/260828_ocx_agentic_control/*
Adds repository pointers and records implementation, verification, command corrections, and CI follow-up findings.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant CLI_CAPABILITIES as CLI capability registry
  participant SURFACE_GENERATOR as surface generator
  participant MANAGEMENT_SURFACE as committed management surface
  participant SKILL_TESTS as skill tests
  CLI_CAPABILITIES->>SURFACE_GENERATOR: provide capability definitions
  SURFACE_GENERATOR->>MANAGEMENT_SURFACE: render capability-to-route documentation
  SKILL_TESTS->>MANAGEMENT_SURFACE: compare committed output with renderer
  SKILL_TESTS->>CLI_CAPABILITIES: validate documented command invocations
Loading

Suggested reviewers: ingwannu

✨ Finishing Touches 💡 1
🛠️ Fix failing CI checks 💡
  • Create stacked PR
  • Commit on current branch
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/ocx-agent-skill

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 27, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c1cf660c23

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread .github/workflows/ci.yml
Comment on lines +430 to +431
- name: Check the generated ocx skill surface is current
run: bun run skill:surface:check

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Include skill files in the CI path filters

The new check is skipped when a pull request changes only skills/ocx/**: the gates job requires needs.changes.outputs.ci == 'true', but the ci filter at lines 176–193 does not include skills/**; the push trigger omits it as well. Consequently, direct edits to the generated surface or invalid commands added to the handwritten references can receive a green aggregate check without running either this step or tests/skill-ocx.test.ts. Add the skill directory to both path allowlists.

AGENTS.md reference: AGENTS.md:L184-L191

Useful? React with 👍 / 👎.

Comment thread skills/ocx/SKILL.md Outdated
Comment on lines +20 to +22
That is the machine-readable index of every verb, the routes it drives, its flags, and whether it
mutates. Read it first rather than guessing a command name — it is generated from the same table
that generates the CLI help, so it cannot describe a verb that does not exist.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Scope the capabilities index to its actual subset

Do not describe this as an index of every verb: CAPABILITIES currently contains only 26 entries and is explicitly marked incomplete in src/cli/capabilities.ts, while CLI_COMMANDS includes commands such as ready, doctor, and access, and even the recipes rely on missing operations such as provider add/test/set-default. An agent following this instruction will therefore fail to discover large parts of the supported CLI; either expand the capability table or state precisely that it covers only the declared management subset.

Useful? React with 👍 / 👎.

Comment thread skills/ocx/references/03_recipes.md Outdated
```bash
ocx ready --json # is it up at all?
ocx status --json # is it the build you think, on the port you think?
ocx doctor --json # what is structurally wrong

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Remove the unsupported JSON flag from the doctor recipe

ocx doctor has no JSON mode: runDoctor in src/cli/doctor.ts:956-1008 recognizes only its repair/recovery flags, silently ignores --json, and prints the normal multiline human report. An agent executing this ostensibly JSON-based diagnostic sequence will receive non-JSON output and fail when parsing it, so use bare ocx doctor or implement and document a real JSON envelope.

Useful? React with 👍 / 👎.

`accounts[]` with `id`, `email`, `plan`, `paused`, `selected`, `priority`, and `needsReauth`. Quota
appears only under `--quota`.

`paused` and `selected` are independent — a paused-but-selected account still receives requests.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Correct the paused-account routing guidance

A paused account does not continue receiving requests merely because it is still displayed as selected. The pause route clears thread bindings and selects a fallback (src/codex/auth-api.ts:1507-1511), and the routing path explicitly excludes paused accounts, as verified by tests/codex-routing.test.ts:375-391. This guidance can make operators believe a successful pause is ineffective; explain that the two display flags may coexist while paused accounts remain ineligible for routing.

Useful? React with 👍 / 👎.

Comment on lines +73 to +74
`storage cleanup`, `storage trash restore`, and `storage policy run` exit 2 without `--yes` and send
no mutating request at all. So an accidental invocation is a no-op, not a partial delete.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep cleanup preview out of the exit-2 group

storage cleanup intentionally succeeds without --yes: cleanup() calls the preview endpoint, prints the preview, and returns normally at src/cli/storage.ts:88-97, yielding exit 0. Only storage trash restore and storage policy run reject missing confirmation with exit 2. Grouping cleanup with them contradicts the preview recipe and will cause automation to treat a successful preview as a usage failure.

Useful? React with 👍 / 👎.

@lidge-jun
lidge-jun force-pushed the codex/ocx-agent-skill branch from c1cf660 to 88b90ad Compare August 27, 2026 20:17
@lidge-jun
lidge-jun force-pushed the codex/ocx-gui-parity branch from 617bab1 to 00a12c9 Compare August 27, 2026 20:17
@lidge-jun
lidge-jun force-pushed the codex/ocx-agent-skill branch from 88b90ad to cafdfb0 Compare August 27, 2026 20:27
@lidge-jun
lidge-jun force-pushed the codex/ocx-gui-parity branch from 00a12c9 to 160b9a0 Compare August 27, 2026 20:27
@github-actions

github-actions Bot commented Aug 27, 2026 •

Copy link
Copy Markdown
Contributor

✅ READY

  • all PR quality gates passed.

Hygiene

✅ Deterministic PR hygiene checks passed.

@github-actions
github-actions Bot marked this pull request as draft August 27, 2026 20:31
@github-actions github-actions Bot added the intake: hygiene-blocked Deterministic PR hygiene checks failed label Aug 27, 2026
…surface map

Every prior phase widened what an agent can do; this makes it discoverable without reading source. The capability-to-route map is generated from src/cli/capabilities.ts and a test fails if the committed copy drifts, because a hand-maintained surface map is a second description of the CLI free to diverge from the first.

A command-existence test caught a documented ocx request-history that never existed, plus three wrong argument shapes. Every recipe was executed against a live proxy rather than transcribed.
The test already catches drift, but as a byte comparison in a test log. A named step tells the contributor which command fixes it.
@lidge-jun
lidge-jun force-pushed the codex/ocx-agent-skill branch from cafdfb0 to 4ea5804 Compare August 27, 2026 20:38
@lidge-jun
lidge-jun force-pushed the codex/ocx-gui-parity branch from 160b9a0 to 1bbd6b9 Compare August 27, 2026 20:38
…scan

Closes the unit. The rebase onto dev was a no-op -- dev never moved off 50e9556 -- so
the ancestry was proved link by link across all nine pairs instead of the step being
quietly skipped.

Three CI failures, three distinct causes, each fixed in the lowest branch that showed it
so the restack carries the fix upward rather than leaving the stack red below the fix.

The part worth reading is the audit. I had scanned every changed file with the hygiene
gate's own helper, got zero matches, and concluded the empty_catch failure was purely a
prose match. The reviewer disproved that: the regex does not match a catch body
containing only a comment, and this stack had added one. The scan was sound and the
conclusion was wrong. It also caught that my first sync-cache fix reported failed
refreshes as deliberate skips.

Both are recorded rather than smoothed over, including the earlier phases' 429-driven
subagent substitution ending here -- this reviewer was a real dispatched explorer.
WP9MSG && git log --oneline -1
@lidge-jun
lidge-jun force-pushed the codex/ocx-agent-skill branch from 4ea5804 to 368d85b Compare August 27, 2026 20:45
@github-actions
github-actions Bot marked this pull request as ready for review August 27, 2026 20:46
@lidge-jun

Copy link
Copy Markdown
Owner Author

리뷰 · 우선순위 58 / 80

이 PR은 ocx 스택이 넓힌 CLI를 에이전트가 소스 안 읽고도 쓰게 하는 운영 스킬입니다. 베이스는 codex/ocx-gui-parity(PR #2787)입니다. Draft가 아닙니다. 지금 dev HEAD 50e955604에는 skills/ 디렉터리가 없고, src/cli/capabilities.ts도 없습니다(그건 #2778 capability-registry부터 쌓입니다). 런타임 동작은 거의 안 바꾸고, 발견 가능성과 문서 드리프트를 막습니다.

구성은 다섯 장입니다. skills/ocx/SKILL.md는 방향·exit code·동의·라우팅이고, references/01_management_surface.md는 scripts/generate-ocx-skill-surface.ts가 capability 표에서 생성합니다. 02_json_shapes.md·03_recipes.md·04_failure_semantics.md는 손으로 쓰되, 레시피는 라이브 프록시에서 실제로 돌려 필드 이름을 맞췄다고 합니다. $CODEX_HOME/skills가 아니라 레포 안에 둔 이유는 이 레포의 CLI 계약과 버전을 같이 맞추기 위해서입니다.

생성 표면을 테스트로 잠근 선택이 핵심입니다. tests/skill-ocx.test.ts가 커밋된 01 파일이 재생성 결과와 바이트 단위로 같다고 보고, CI에 bun run skill:surface:check 스텝이 있습니다. 손으로 두 번째 설명을 쓰면 이 스택이 지우려던 “표면이 둘로 갈라짐”이 다시 생깁니다. 커맨드 존재 게이트도 실제 오류를 잡았습니다. 설계 문서의 ocx request-history는 없고 실제는 ocx logs explain <request-id>입니다. access key add/remove 플래그 형태와 provider default도 실제 위치 인자·set-default와 달랐습니다. 스킬이 없는 명령을 적으면 에이전트는 도구가 고장 났다고 결론 냅니다.

동의 경계도 분명합니다. star를 사용자 대신 하지 말라고 적고, gh·생 HTTP·위조 세션 우회를 금지합니다. 페이지에 gh api가 있으면 실패하는 테스트까지 있습니다. docs-site 영어 reference/cli.md에 exit 표(0/2/4/5/1)와 storage preview-first, 이번 스택 동작 변화를 더합니다. 번역 7로케일은 덜 채워져도 영어와 모순되지는 않게 두는 방침입니다. types/config 분할과는 무관하고 preview deploy도 없습니다. 다만 #2787 위라 그 앞 ocx 스택이 안 올라가면 스킬이 가리키는 동사가 dev에 아직 없습니다.

라인 skills/ocx/SKILL.md - 방향·exit·동의. star/gh 우회 금지 문장.

라인 scripts/generate-ocx-skill-surface.ts - capability → 01_management_surface.md 생성기.

라인 skills/ocx/references/01_management_surface.md - 생성물. 손편집 금지, check가 잠금.

라인 tests/skill-ocx.test.ts - 바이트 일치·커맨드 존재·부정 문장 스킵·gh api 금지를 잠금.

라인 docs-site/.../reference/cli.md - exit 표·preview-first·스택 동작 변화. 영어 우선.

라인 .github/workflows/ci.yml / package.json - skill:surface:check 스텝·스크립트 등록.

경로 base - #2787 위. gui-parity와 capability 스택이 먼저여야 스킬이 가리키는 명령이 실재합니다.

메인테이너의 판단이 필요한 지점

  • 스킬을 이 스택과 같이 머지할지, 런타임 PR들이 먼저 오른 뒤에 올릴지
  • 7로케일 CLI 번역을 이번 PR에서 더 채울지(지금은 영어 additive)
  • AGENTS.md에 스킬 경로를 고정 링크로 넣을지

너의 추천
#2787이 머지된 직후 같이 올리세요. 생성 표면+존재 게이트는 유지하세요. star/gh 우회 금지는 풀지 마세요. 로케일 번역은 후속으로 둬도 됩니다.

이 댓글은 grok-bot이 작성했습니다

Base automatically changed from codex/ocx-gui-parity to dev August 28, 2026 12:39
jun and others added 2 commits August 28, 2026 21:39
Cleanup without --yes is a preview that exits 0, API failures still
print stderr not an error envelope, and doctor has no --json mode.

Co-authored-by: Cursor <cursoragent@cursor.com>
@lidge-jun
lidge-jun merged commit 6d0d7f0 into dev Aug 28, 2026
3 checks passed
@lidge-jun
lidge-jun deleted the codex/ocx-agent-skill branch August 28, 2026 12:41
@github-actions github-actions Bot removed the intake: hygiene-blocked Deterministic PR hygiene checks failed label Aug 28, 2026
tarunravi pushed a commit to tarunravi/opencodex that referenced this pull request Sep 14, 2026
docs(skill): add the repo-owned ocx operating skill
agentHits pushed a commit to agentHits/opencodex that referenced this pull request Sep 17, 2026
docs(skill): add the repo-owned ocx operating skill
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant