Multiple documentation polish items rolled into one PR (one layer: "docs alignment with current state"). ### README.md - **Uninstall section** added between Server Setup and Client Setup (was missing — `node uninstall.mjs` exists but went undocumented). - **OpenClaw definition** added as a footnote on first README mention (the architecture diagram and Supported Tools table both reference OpenClaw without ever defining it). - **Repository Layout section** added before Security — table of top-level files (server.mjs, setup.mjs, uninstall.mjs, keys.mjs, models.json, ocp/ocp-connect, dashboard.html, scripts/, .claude/skills/, ocp-plugin/, docs/adr/, ALIGNMENT.md, AGENTS.md, CLAUDE.md) so a new contributor knows what each file does. - **LICENSE link** added to the License section footer. ### docs/adr/README.md (new) - Index of the three published ADRs (0002, 0003, 0004) with a one-line description each. - Explains the `0001` placeholder (early internal proposal that was superseded; numbering deliberately starts at `0002`). - Guidance on when to write a new ADR vs. when a commit message suffices. ### Spec/plan housekeeping - `specs/.gitkeep` removed (the empty `specs/` placeholder confused the picture; canonical paths are `docs/superpowers/plans/` for active plans and `docs/superpowers/specs/` for long-lived design docs that other code references). - Shipped plans moved to `docs/superpowers/plans/shipped/`: - `2026-04-10-lan-mode.md` (shipped: README LAN mode section) - `2026-04-25-47-sse-heartbeat-plan.md` (shipped: v3.12.0 per CHANGELOG) - `2026-04-25-47-sse-heartbeat-design.md` left in `docs/superpowers/specs/` unchanged because both `server.mjs:565` and `CHANGELOG.md:7` link to that exact path; moving it would require a `server.mjs` edit, which needs `cli.js` citation per ALIGNMENT.md Rule 1. ### AGENTS.md - Updated "Key files to know" to add `docs/adr/README.md`, `docs/superpowers/plans/`, and `memory/constitution.md`. - Note explaining `memory/constitution.md` is spec-kit's standard location, distinct from `~/.cc-rules/memory/` and `ALIGNMENT.md`. - Updated "Handoff expectations" item 5 from `docs/superpowers/specs/*/tasks.md` (which never matched anything — there were no `tasks.md` files there) to `docs/superpowers/plans/` (excluding `shipped/`). ### Coordination with PR #53 PR #53 is open and adds "Why OCP?", "Comparison", and "Governance" sections to README. This PR deliberately avoids those areas — only edits the Supported Tools table footnote, inserts Uninstall before Client Setup, inserts Repository Layout before Security, and updates the License footer. No expected merge conflict. Refs: audit findings M6, M8, M9, M11, L2, L3, L6. Co-authored-by: dtzp555 <dtzp555@gmail.com>
4.9 KiB
Inherits: @~/.cc-rules/AGENTS.md
OCP — Open Claude Proxy — Agent Guidelines
Scope: the dtzp555-max/ocp repository.
Audience: any AI coding agent (Claude Code / Cursor / OpenCode / Copilot / Codex / Gemini) touching OCP source.
What this project is
OCP (Open Claude Proxy) is an open-source HTTP gateway that sits between the Claude Code CLI (cli.js) and Anthropic's public API. It forwards, observes, and multiplexes traffic that cli.js already emits — it is explicitly not an extension layer. A secondary role: registering OCP as a local provider inside OpenClaw (a sibling IDE-agnostic tool), so that users running OpenClaw against OCP see the same model list as native Claude Code.
Runtime: Node.js (ESM, .mjs throughout). No build step. No bundler. server.mjs is the single executable entrypoint; ocp and ocp-connect are CLI wrappers.
Stack
- Node.js >=18, native ESM modules
http/httpsbuilt-ins for the proxy core (no Express, no Fastify)models.jsonas the single source of truth for model metadata- GitHub Actions for CI (
alignment.yml,release.yml) ghCLI assumed for PR creation and release automation- No TypeScript. No test framework beyond
test-features.mjs(run vianpm test; CI workflow.github/workflows/test.yml). Keep dependencies minimal.
Key files to know
server.mjs— the proxy itself; every request path lives here. Governed byALIGNMENT.md.models.json— single source of truth for model IDs, aliases, and context windows. See ADR 0003.setup.mjs— first-time installer; readsmodels.jsonto derive bootstrap config.scripts/sync-openclaw.mjs— idempotent OpenClaw registry sync invoked byocp update. See ADR 0004.ocp— user-facing CLI (install, update, start, stop, status, logs, etc.).ALIGNMENT.md— the constitution. Binding for anyserver.mjschange. See ADR 0002..github/workflows/alignment.yml— CI blacklist grep; fails the build on known-hallucinated tokens.CLAUDE.md— Claude-Code-specific session instructions + release_kit overlay (Iron Rule 5.5).docs/adr/— Architecture Decision Records. Read these before proposing governance or SPOT changes. Seedocs/adr/README.mdfor the index.docs/superpowers/plans/— active spec-kit plans.docs/superpowers/plans/shipped/archives plans that have been delivered (don't propose changes against shipped plans — they're history).docs/superpowers/specs/holds long-lived design documents that other code references (e.g., the SSE heartbeat design referenced fromserver.mjs).memory/constitution.md— spec-kit's project constitution (its standardmemory/location). Distinct from~/.cc-rules/memory/(cross-machine personal memory) and from this repo'sALIGNMENT.md(the OCP code-level constitution).
Project-specific constraints
ALIGNMENT.mdis binding. Any PR touchingserver.mjsmust citecli.js:NNNN(orcli.js vE4 <functionName>) in the commit body and PR description. SeeCLAUDE.md§ "Hard requirements forserver.mjschanges" and ADR 0002.- Alignment CI is not suppressible. The
alignment.ymlworkflow grepsserver.mjsfor known-hallucinated tokens (currently blockingapi.anthropic.com/api/oauth/usage). Adding new tokens is done via PR amendment toalignment.yml; removing entries requires anALIGNMENT.mdamendment PR. - No self-approval. Implementation author cannot merge their own PR (Iron Rule 10). A fresh-context reviewer must open
cli.jsat the cited lines and confirm in the review comment. models.jsonis the only place to add/edit models. Do not touchMODEL_MAPorMODELSarrays directly inserver.mjsorsetup.mjs. See ADR 0003.- OpenClaw boundary.
scripts/sync-openclaw.mjsonly writesmodels.providers["claude-local"].modelsandagents.defaults.models["claude-local/*"]in~/.openclaw/openclaw.json. Do not expand scope. See ADR 0004.
Release protocol
OCP follows the machine-readable release_kit: overlay in CLAUDE.md (Iron Rule 5.5). Before any version bump or tag push, re-read that YAML block and walk every item in new_feature_doc_expectations and bootstrap_quirk_policy. Tag push triggers .github/workflows/release.yml, which creates the GitHub Release automatically — do not create the release manually.
Version is sourced from package.json; changelog from CHANGELOG.md; user-facing docs from README.md.
Handoff expectations
A fresh session picking up OCP work should read, in order:
- This file (
AGENTS.md). ALIGNMENT.md— constitution; non-optional.CLAUDE.md— tool-specific instructions and release_kit overlay.docs/adr/— most recent ADRs first; they explain why the current structure exists.- Any active plan under
docs/superpowers/plans/(excludingshipped/which is the archive). ~/.cc-rules/memory/auto/MEMORY.md— cross-machine memory index.
Only after these should the session touch code.