Repository navigation
chore(claude): distill session experience into agent assets; drop dead opsx commands and stale release skill - #184
Conversation
…kill The opsx commands drive an OpenSpec change workflow for which this repo has no openspec/ directory and zero recorded usage; drop them. The release skill reflects v1.0.1-era knowledge (missing the six-point version sync surface and the tag delete/re-push recovery procedure that broke the v1.4.0 and v1.0.0 releases) and is superseded by the new release-engineering skill.
… and hooks Consolidates the recurring lessons from the 2026-08/09 engineering sessions (previously only in AI-session memory) into versioned, tool-agnostic assets: - skills: ci-gate-sync (sync-point policies for error codes/endpoints/ migrations/headers), ci-failure-triage (cross-compiler WERROR blind spots, flake taxonomy), release-engineering (six-point + ~15 version carriers, tag recovery, PyPI first publish), pr-workflow (rebase-merge repair, rebase value-loss audit, PAT permission boundary), local-env-runbook (Windows/WSL/Docker/Mimosa/multi-session rules), test-methodology (two test layers, mock injection seam, Playwright pitfalls), and benchmark-methodology (wrk Lua model, A/B discipline, measurement-artifact taxonomy). - rules (path-scoped): sync-points (8-point error-code and 5-point endpoint hard checklists), frontend-contract (verified frontend/backend contract facts), async-cpp-gotchas (traps beyond db-operations: Session::insert no-overwrite, callback double-move, ::drogon:: shadowing). - commands: /preflight (local gate sweep before pushing), /ci-triage (failure classification workflow). - hooks: local-gates.sh (wired to the git-commit PreToolUse hook, replacing the broken full-ctest gate), port-guard.sh, redis-watchdog.ps1. Provenance (source retrospectives): ci-gate-sync/rules.sync-points from PR #115/#141/#149/#157/#179/#180 CI post-mortems; release-engineering from the v1.0.0-v1.1.0 release runs; test-methodology from the coverage push (48.5%->57.2%) and PR #140/#156 e2e work; benchmark-methodology from the four-product comparison campaign; local-env-runbook from environment incident records. AGENTS.md indexes the new rules and skills.
- dev-workflow rule: endpoint test counts 37/17 -> 52/59 (two-year-old numbers), direct-run server path now includes the build preset and the launch-directory requirement, plus a pointer to the new knowledge skills. - project-conventions skill: password hashing described as PBKDF2-SHA256 with 310k iterations (was 'SHA-256 + salt'); test naming pattern updated to the enforced P-priority segment form. - settings.json: the pre-commit hook pointed at a nonexistent build/tests directory (would block every Claude Code commit with 'Build directory not found') and ran the full ctest suite per commit; it now runs the fast local-gates.sh sweep. The clang-format PostToolUse hook now formats only the edited file instead of every tracked C++ file. - CODEBUDDY.md: drop the inaccurate claim that .claude/rules auto-load in CodeBuddy (that is Claude Code behavior) and the stale reference to a nonexistent .codebuddy/settings.json; state the AGENTS.md-index read path instead.
…SL prod staging Distills the deployment knowledge that previously lived only in session memory: the .env.docker.dev/.prod consumption matrix (dev compose hardcodes everything except SMTP; --env-file only interpolates, never injects; the dead DOMAIN/BOOTSTRAP_ADMIN_PASSWORD variables), production startup validation (#102) and the dev-seed-must-not-reach-prod rule, the five-step WSL prod staging procedure (ext4 clone, engine conflict with the dev stack, --build to bypass the blocked registry, migrate profile, hosts + self-signed CA into the WSL trust store so the 59/52 endpoint scripts run the full nginx chain), the fresh-clone server migration flow (no data migration), and the healthcheck-asymmetry / absolute_redirect / compose-project-name triage notes. dev-workflow.md indexes the new skill.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: af7f7607d7
ℹ️ 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".
| { | ||
| "type": "command", | ||
| "command": "if [ ! -d build/tests ]; then echo 'Build directory not found. Run manage.sh build-backend first.' && exit 1; fi && echo 'Running pre-commit tests...' && cd build/tests && ctest --output-on-failure && echo 'Tests passed, commit allowed' || (echo 'Tests failed, commit blocked' && exit 1)" | ||
| "command": "bash .claude/hooks/local-gates.sh" |
There was a problem hiding this comment.
Avoid blocking every commit on optional SDK generators
This hook now runs the five gates for every git commit, including regen_clients.py --check, which exits nonzero when openapi-python-client or oapi-codegen is not installed. In a normal checkout that has only the backend toolchain (or for an unrelated documentation change), this prevents the agent from committing at all; the nominal no-PyYAML fallback in the governance gate also cannot parse the current OpenAPI file. Make these dependencies part of the hook's bootstrap or reserve the full sweep for explicit preflight/relevant changes.
Useful? React with 👍 / 👎.
| 3. **前端门**(改过 frontends/** 时,在对应目录): | ||
| ```bash | ||
| npm run build && npx playwright test --reporter=line | ||
| # 改了组件双副本/错误码文案时另跑:node ../scripts/check-ui-sync.mjs(repo 根) |
There was a problem hiding this comment.
Invoke the UI sync checker from the correct directory
Step 3 says frontend checks are run from frontends/admin or frontends/user, but node ../scripts/check-ui-sync.mjs resolves to frontends/scripts/check-ui-sync.mjs, which does not exist. The checker is at the repository-root scripts/check-ui-sync.mjs, so this prescribed follow-up fails whenever a contributor changes duplicated UI components or error messages. Use ../../scripts/check-ui-sync.mjs from an app directory, or explicitly switch back to the repository root.
Useful? React with 👍 / 👎.
| 2. **WERROR 构建对齐**(改过任何 C++ 时;配置一次后增量跑,注意增量缓存假绿——改过头文件删 | ||
| 对应 .obj 或 `--clean-first`): | ||
| ```bash | ||
| cmake --preset windows-msvc -DFULLA_WERROR=ON && cmake --build build/windows-msvc --config Release |
There was a problem hiding this comment.
Select the WERROR preset for the host platform
When /preflight is used on Linux or macOS, this required C++ validation step cannot configure: the windows-msvc preset is conditionally available only on Windows, while the repository has separate linux-release and macos-arm64 presets. As written, non-Windows contributors cannot complete the documented preflight for any C++ change; choose the platform-specific preset or document separate commands.
Useful? React with 👍 / 👎.
Summary
Consolidates the recurring lessons from the 2026-08/09 engineering sessions (previously available only in AI-session memory, re-derived and re-hit every few weeks) into versioned repo assets under
.claude/, which is the repo's single source of truth for agent guidance. Also removes dead/superseded assets and repairs two broken hooks in.claude/settings.json..claude/is chosen as the authoritative home over a new directory: it is the format with the widest project-level compatibility (Claude Code native; opencode and Cursor read.claude/skillstoo), and cross-tool agents (CodeBuddy, Qoder, ZCode) already consume this repo through the rootAGENTS.mdindex, which this PR extends.What's added (8 skills / 3 rules / 2 commands / 3 hook scripts)
Skills (knowledge + policies):
ci-gate-sync- sync-point policies when touching error codes / endpoints / migrations / public headers (8-point error-code, 5-point endpoint checklists; api-diff ADDITIVE-vs-BREAKING policy; oasdiff single-line exact-prefix exemption rules; reusable-workflow permission ceiling)ci-failure-triage- cross-compiler WERROR blind-spot matrix, flake vs defect triage, gcov CWD root cause, conan.lock cross-platform discipline, ERESOLVE false-red identificationrelease-engineering- six-point version sync + ~15 secondary carriers, three-gate preflight, tag delete/re-push recovery, release-object-before-tag retirement order, PyPI first-publish token rules, all-English release notes policy (supersedes the deletedreleaseskill)pr-workflow- rebase-and-merge conventions, conflict repair via cherry-pick + patch-id audit, rebase value-loss audit, gh PAT permission boundary, issue triage three-way splitlocal-env-runbook- Windows/WSL/Docker environment runbook (Redis zombie detection, port 5555 mutual exclusion, Mimosa hook workarounds, MSYS path mangling, multi-session ownership rules)test-methodology- two test layers (ctest in-process + 59/52 endpoint scripts), mock injection seam keepAlive pattern, Playwright pitfalls, flake vs isolation-defect classificationbenchmark-methodology- wrk Lua threading model, A/B discipline (negative control + re-run arm), measurement-artifact taxonomy, honest-claims red linesdeployment-runbook-.env.docker.dev/.prodconsumption matrix, production startup validation, five-step WSL prod staging (hosts aliases + self-signed CA into the WSL trust store so the 59/52 endpoint scripts run the full nginx chain), server migration flowRules (path-scoped, indexed from AGENTS.md):
sync-points.md,frontend-contract.md,async-cpp-gotchas.mdCommands:
/preflight(local gate sweep before pushing),/ci-triage(failure classification workflow)Hook scripts (
hooks/):local-gates.sh(the five python/bash gates, wired to the git-commit PreToolUse hook),port-guard.sh,redis-watchdog.ps1What's removed / fixed
commands/opsx/(OpenSpec workflow for a directory this repo does not have; zero usage),skills/release/(v1.0.1-era knowledge, missing the six-point sync surface and tag recovery procedure that cost the v1.4.0/v1.0.0 releases)settings.json: the pre-commit hook pointed at a nonexistentbuild/testsdirectory and would block every Claude Code commit with "Build directory not found"; it now runs the fastlocal-gates.shsweep. The clang-format PostToolUse hook now formats only the edited file instead of every tracked C++ file on each edit.dev-workflow.md; password hashing described as PBKDF2-SHA256 310k inproject-conventions; test naming pattern aligned with the enforced P-priority formCODEBUDDY.md: dropped the inaccurate claim that.claude/rulesauto-loads in CodeBuddy (Claude Code-only behavior) and the reference to a nonexistent.codebuddy/settings.jsonVerification
.claude/hooks/local-gates.sh)git patch-id --stablecomparison vs pre-rebase originals) and the branch net diff touches only.claude/**,AGENTS.md,CODEBUDDY.mdlocal-gates.shandport-guard.shexecuted successfully on this machine; docs/markdown-only changes - no product code touchedOut of scope
.zcode/skills,.zcode/commands) stay untracked per the existing convention for per-tool local workspaces