God-Mode通用机制交接
god-mode-generic-mechanic-handoff
当把 Jeff 批准、与设置无关的 god-mode/神圣机制交接给 AO 时使用——涵盖“通用”框架规则、四机制契约集(avatar partition/dual-sheet、original→shell 插值、shell 与 original 分离、rank-anchored DHP)、规范公式注册表指令接口、TDD RED→GREEN 测试框架、/es real-LLM 采集、在 origin/main 上强制干净重放,以及从 agent 漂移或未跟踪 worktree 中强制恢复。触发短语包括“approve generic mechanic”、“generalize avatar partition”、“surface formula registry”、“god mode directives / canonical formula registry”、“/repro god mode”、“issue 8538”、“bead rev-ct974”、“PR”。
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 6
- Forks
- 0
01 前言 Front Matter
- name
- god-mode-generic-mechanic-handoff
- description
- Use when handing a Jeff-approved, setting-agnostic god-mode/divine mechanic to AO — covers "generic" framing rules, the four-mechanic contract set (avatar partition/dual-sheet, original→shell interpolation, shell-vs-original separation, rank-anchored DHP), canonical formula-registry directive surface, TDD RED→GREEN harness, /es real-LLM capture, mandatory clean replay on origin/main, and forced-recovery from agent drift or untracked worktrees. Trigger phrases include "approve generic mechanic", "generalize avatar partition", "surface formula registry", "god mode directives / canonical formula registry", "/repro god mode", "issue 8538", "bead rev-ct974", "PR
02 资源文件 2
- 参考文档references/verify-checklist.md1.1 KB
- 脚本tests/test_skill_contract.py2.7 KB
03 SKILL.md 正文
god-mode-generic-mechanic-handoff
Replay-safe handoff for a Jeff-approved, setting-agnostic god-mode/divine mechanic into $GITHUB_REPOSITORY via Agent-Orchestrator. Lessons learned during the 2026-07-22→2026-07-23 implementation cycle that drove PR #8541 (HEAD 0b0bc4ac7) and audit failures on earlier failed workers (wa-3380, wa-3382, wa-3384).
When to use
- Jeffrey approves a generic (setting-agnostic, no campaign-specific names) god-mode/divine mechanic.
- An issue like #8538 or bead like
rev-ct974is opened tracking a 4-part contract: avatar partition/dual-sheet, original→shell interpolation, shell-vs-original separation, rank-anchored DHP + canonical formula registry directive surface. - The BQ evidence base already shows the model is reading the prompt but the loaded block omits the canonical formula or dual-sheet rules.
Generic framing rules (non-negotiable)
- No campaign-specific names, numbers, or lore in shared
$PROJECT_ROOT/prompts/**files,agent_prompts.py, or contract tests. Put those incustom_campaign_state.formula_registry/directivesonly. current_shell_levelis the mortal sheet (HP, stats, Story Mode reads).original_levelis the underlying divine level. Never collapse the two.current_shell_levelis interpolated viaformula_registry.shell_level_from_original(lower/upper anchors). Never copyoriginal_levelintocurrent_shell_level. Never flatten every divine actor to the mortal cap.- HP is bounded by the mortal HP table at
current_shell_level. Divine HP (DHP) is a separate stat read fromformula_registry.divine_hp_cap(or named equivalent) anchored onrank_table[original_level]. DHP is NEVERhp_current * k. - The "Canonical Formula Registry" block must be appended verbatim to the god-mode directives block when
custom_campaign_state.formula_registryis present, and omitted when absent (no spurious empty section).
Branching & clean-replay contract
git checkout -B <branch> origin/mainBEFORE writing code. Never branch off an existing non-clean history.- Stage ONLY the four intended files:
$PROJECT_ROOT/agent_prompts.py,$PROJECT_ROOT/prompts/god_mode_instruction.md,$PROJECT_ROOT/tests/test_god_mode_formula_registry_contract.py,testing_mcp/test_god_mode_avatar_partition_contract_real_api.py. - After staging, run
git diff --name-only origin/main..HEADand STOP if you see drift files (bq_logging.py,world_logic.py,roadmap/**, deleted test files unrelated to the task,.beads/**,.claude/settings.json). - Recovery pattern when the agent already polluted history:
git checkout -B <branch> origin/main,git show <bad-sha> -- <four intended files> | git apply --include=<each path>, commit cleanly,git push --force-with-lease origin <branch>. - After force-push, verify with
git rev-parse origin/<branch>and confirmgh pr view <N> --json fileslists only the four intended paths. If PR #8541 already existed, the headRefOid will update on the same PR — do NOT close and re-open.
Spawn the right worker (lesson: MiniMax-M3 + agy gate)
- AO exposes 2-3 worker harnesses. Prefer mid-tier explicit override.
- MiniMax-M3 (
ao spawn ... --agent minimax) — fastest path, but verify it has not silently hung withkill -CONT $(pgrep -P <pane>)if pane stalls. agy --prompt-interactive ... --model gemini-3.8-flash-high --dangerously-skip-permissions --new-project— works well for TDD cycles; needsHOME=$HOME GEMINI_CLI_TRUST_WORKSPACE=truein the env block.- Codex harness — historical reliability issues; do NOT use it for prompt-only contracts.
- MiniMax-M3 (
- Heartbeat the agent before
ao spawn:agy --print --model <tier> --print-timeout 60s --prompt "pong". If it stalls >90s, kill and switch tiers. Never retry the same tier that failed. - Provide the task brief via
env -i ... $AO spawn -p worldarchitect --agent minimax "<task text>". Pass full task brief as the task argument — never condense. - Include in the brief, verbatim:
Issue 8538 / bead rev-ct974. Explicit mid-tier <tier>. Immediately implement via TDD; no broad research. Use current origin/main. Write RED tests, minimal generic loaded prompt/dynamic-delivery fix, GREEN, real /es, commit, push, clean draft PR. Do not stop before push + PR. - DO NOT trust
--agent agyAO plugin flag without confirming withao spawn --help; MiniMax plugin is currently the explicit mid-tier option.
TDD contract tests (RED→GREEN)
- Write
$PROJECT_ROOT/tests/test_god_mode_formula_registry_contract.pyFIRST. Required assertions:Canonical Formula Registryblock is appended whenformula_registryis set.- Section header, formula
name, expression, anchors (lower_anchor/upper_anchor) are all rendered verbatim. - Empty
formula_registryproduces no spurious block.
- Write the prompt-text assertions for the four protocol rules:
current_shell_levelbounded by mortal cap; not flat-translated fromoriginal_level.- DHP comes from rank-table, NOT HP multipliers.
- Lower-case the prompt text in the test, not the assertions, to dodge case-fold edge cases (
do NOT flatten⇆do not flatten).
- GREEN with the
_build_formula_registry_blockhelper that joinsname,expression,anchors,applies_whenonly whenexpressionis a non-empty string. Skip entries that aren't dicts or have no expression. - Re-run the broader regression suite under
$PROJECT_ROOT/tests/test_god_mode_*— the canonical block must not break neighboring tests.
/es real-server + real-LLM evidence (non-negotiable)
- The repo AGENTS.md says any non-test change under
$PROJECT_ROOT/**requires/es(real local server + real services + real LLM where the path uses an LLM). Unit tests alone FAIL the gate. - Required:
testing_mcp/test_god_mode_avatar_partition_contract_real_api.pythat usesMCPTestBase, starts a realgunicorn mvp_site.main:appon a free port (e.g. 8055 or 56958), runs a real god-mode LLM turn, then greps the captured JSONL traces for:Canonical Formula Registryheadershell_level_from_originalformula name- The interpolation expression text (read the file with
catand copy the exact expected string verbatim) lower_anchorandupper_anchorsubstringsrank_table[original_level]expression
- The grep helper must walk nested dicts/lists and stringify any string field — do NOT rely on
row.get("system_text")shape. Working pattern:def _row_string_fields(row): parts=[]; _walk(row) # recursive walk def _walk(v): if isinstance(v,str): parts.append(v) elif isinstance(v,list): [ _walk(i) for i in v ] elif isinstance(v,dict): [ _walk(x) for x in v.values() ] return parts def _grep_all_jsonl(paths, needle): nl=needle.lower() for p in paths: for row in _scan_jsonl(p): for v in _row_string_fields(row): if nl in v.lower(): return True return False - Use
$PROJECT_ROOT/CLAUDE.mdas a hint for what trace files exist (llm_request_responses.jsonl,provider_http_request_responses.jsonl,request_responses.jsonl). CheckMCP_TEST_EVIDENCE_DIRenv var if available. - Real
/estakes ~3–7 minutes per turn because of full server startup + real LLM call. Budget 10m timeout.
Failures the agent WILL hit (and how to recover)
- Worker over-researches: it will spend 5–8 minutes on file inspection when the brief names the loaded files explicitly. Send
ao send <session-id> 'You are over-researching. Stop now and execute TDD. Write the RED contract test immediately, run it, implement minimal fix. Do not inspect more files.'The MiniMax harness responds toao send; agy responds to tmux send-keys. - Worker claims "pure prompt exception" for /es: push back hard. Repo AGENTS.md is fail-closed for
$PROJECT_ROOT/**non-test changes. Worker must run the real-LLM harness. - Worker attaches evidence to an unrelated PR (e.g. PR 8539 was an MBTI fix when this task wanted PR 8541). Verify
gh pr list --head <branch> --json number,headRefNameimmediately. If the worker created PR 8539 by accident, send a correction:'Critical topology correction: PR 8539 is unrelated... Do not reference, update, push to, or attach evidence to PR 8539. Your branch currently has no PR. After real /es + tests + commit + push, create a NEW clean draft PR from <branch> to main, closing issue 8538.' - Worker drift files: 5 extra files land in the PR diff (
bq_logging.py,world_logic.py, deleted unrelated test files,roadmap/**). Apply the recovery pattern under "Branching & clean-replay contract" §4. - Worker tmux exits but
ao sendkeeps queuing: if you see the worker output stream go quiet for >2 min AND tmux session no longer intmux list-sessions, the lifecycle manager killed it. Treat as killed. Inspect$HOME/.agent-orchestrator/<project-hash>-*/observability/processes/lifecycle-manager-*.jsonforlifecycle.transitionevents withnewStatus:"killed". - Wdefunct agy.real pid blocking tmux pane: when
kill -TERMleaves a<defunct>zombie, dokill -CONT <parent_tmux_pid>to wake the tmux server so new sessions spawn. The zombie won't go away without sudo, but the parent tmux is the only thing you need for new sessions.
Hard-coded paths the skill assumes
$HOME/projects/your-project.com/.claude/worktrees/bq-llm-logging/scripts/bq_evidence_query.sql— schema-stable BQ query template for god-mode turns.$HOME/.hermes/lib/outbound_secret_gate.py— always run on PR body and any log artifacts before push.$HOME/.hermes/skills/finish-the-job/SKILL.md— for the FINISH state contract.$HOME/.hermes/skills/agento/SKILL.md— for AO spawn/send/review.$HOME/.hermes/skills/eval-vendor-tooling/SKILL.md— Pitfall P1 (directives must route via system_instruction, not contents[]) is what made this generic contract get lost in the first place.$HOME/.hermes/skills/workflow/always-pr-never-local-edit/SKILL.md— the durable end-state contract.$HOME/.hermes/skills/workflow/pr-cleanup-replay/SKILL.md— the recipe applied when the AO worker polluted the branch.
Verification checklist before posting "done"
- [ ]
git -C $WT diff --name-only origin/main..HEADshows EXACTLY the 4 intended files (no.claude/settings.json, noroadmap/**, no deleted unrelated tests). - [ ]
git -C $WT rev-parse origin/main origin/$BR— local and remote HEAD match. - [ ]
gh pr view <N> --json fileslists only the 4 paths and matches the diff above. - [ ]
/esevidence (real server + real LLM trace grep) is captured in a/tmp/your-project.com/<branch>/god_mode_avatar_partition_contract_real_api/artifact and pasted into PR description## Evidencesection. - [ ] No
gh pr mergewas issued; orchestrator owns the merge. - [ ] Slack status posted to
#ai-generalwith PR URL + the new HEAD SHA + the bq campaign id used for repro.
Out-of-scope (do NOT do)
- Do not close PR 8541 if the same branch was force-pushed to a clean replay — the PR is updated in place.
- Do not create a fresh bead ID when one already exists in caller repo.
- Do not edit
.claude/settings.jsonor includeAO-TASK-BRIEF.mdin git history. - Do not propose "send raw" repro LLM requests to BQ from inside this skill — that lives in
repro-twin-clone-evidence. - Do not promise to "generalize later" — the brief is for the single, approved mechanic at a time.
04 同仓库更多 Skills
disk-reclaim-playbook
Use Disk Magician to diagnose disk growth or qualify cleanup on macOS or Linux.
claudea-bench
Compare `claudea` and normal `claude` on a fair split of comparable work by default; use `--strict` for duplicate runs of the exact same task.
pr
Alias for the canonical pr-lifecycle PR workflow skill (/pr-workflow, /prw).
whisper
OpenAI's general-purpose speech recognition model. Supports 99 languages, transcription, translation to English, and language identification. Six model sizes from tiny (39M params) to large (1550M params). Use for speech-to-text, podcast transcription, or multilingual audio processing. Best for robust, multilingual ASR.
webapp-testing
Toolkit for interacting with and testing local web applications using Playwright. Supports verifying frontend functionality, debugging UI behavior, capturing browser screenshots, and viewing browser logs.
pr-report
This skill should be used when the user asks for a PR report, PR audit, PR delta analysis, /pr-report, or wants per-PR summary with delta files/lines. Generates a structured report for one or more open PRs covering purpose, files changed, +/− line counts, /code-standards + /thermo review findings, /ponytail simplification opportunities, file-overlap combination candidates, and /green status per pr-green-definition. Output: machine-readable JSONL + human-readable markdown. Read-only by default; can apply simplifications if user opts in.