[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M6C2VSK58CM277QB3Y2MFKEC":3,"skill-same:01M6C2VSK58CM277QB3Y2MFKEC":124},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":8,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":13,"sourceHtmlUrl":17,"categories":18,"keywords":29,"publishedAt":60,"linkOnly":61,"markdownContent":62,"markdownBody":63,"frontMatter":64,"refName":97,"commitSha":98,"skillDirectory":99,"forksCount":100,"repositoryHtmlUrl":101,"repositoryHomepageUrl":13,"ownerHtmlUrl":102,"ownerBlogUrl":13,"ownerDescription":13,"updatedAt":103,"install":104,"resources":117},"01M6C2VSK58CM277QB3Y2MFKEC","write-goal","结果导向目标规格撰写","Write an outcome-driven goal spec that drives agents toward verifiable outcomes — solid evidence, green-CI PRs, high code quality. Pulls context from the last 30 days of coding-CLI convos (\u002Fhistory) and cross-session memory (\u002Fms) so the goal is grounded in real past failures, not invented acceptance criteria. Output is a .converge\u002Fgoal.md ready to feed \u002Fh (goal_harness) or \u002Fa (finish-the-job). Grounded in a 30-day audit of 6,433 Hermes + 18,773 Codex sessions (2026-06-28).","撰写结果导向的目标规格，驱动智能体达成可验证的成果——扎实的证据、CI 全绿的 PR、高质量代码。从过去 30 天的编码 CLI 对话（\u002Fhistory）和跨会话记忆（\u002Fms）中提取上下文，使目标建立在真实的历史失败之上，而非凭空编造的验收标准。输出为 .converge\u002Fgoal.md，可直接提供给 \u002Fh（goal_harness）或 \u002Fa（finish-the-job）。基于对 6,433 个 Hermes 会话与 18,773 个 Codex 会话的 30 天审计（2026-06-28）。","jleechanorg\u002Fjleechan-skills","jleechanorg","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F221404966?v=4","01M6C1VJ99XG950X1DWPEBCBGX",null,"01M6C1VJDK5YVDNT3362RT5WSB",6,"MIT","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-08-29-unused-and-redundant\u002Fwrite-goal\u002FSKILL.md",[19,24],{"categoryNo":20,"categoryName":21,"taxonomyType":22,"taxonomyTypeDesc":23},"01M8BQ6TQZN6R52WBJ9H8NRMQM","软件开发工程师","PROFESSION","适用职业",{"categoryNo":25,"categoryName":26,"taxonomyType":27,"taxonomyTypeDesc":28},"01M8BTBRTQXJ9T5TABNS7XP1A0","任务规划与分解","SCENARIO","使用场景",[30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59],"write goal","write","goal","only","2026","phase","definition","converge","past","jsonl","local","session memory","bug","skeptic","repro","ready","design","never","ms","code-quality","Meta","ci","search","acceptance","qa","code","workflow","ponytail","memory","cli","2026-11-10 10:12:30",false,"---\nname: write-goal\nversion: 1.1.0\ndescription: \"Write an outcome-driven goal spec that drives agents toward verifiable outcomes — solid evidence, green-CI PRs, high code quality. Pulls context from the last 30 days of coding-CLI convos (\u002Fhistory) and cross-session memory (\u002Fms) so the goal is grounded in real past failures, not invented acceptance criteria. Output is a .converge\u002Fgoal.md ready to feed \u002Fh (goal_harness) or \u002Fa (finish-the-job). Grounded in a 30-day audit of 6,433 Hermes + 18,773 Codex sessions (2026-06-28).\"\nwhen_to_use: \"Use when the user types \u002Fwrite-goal \u003Ctopic>, asks to 'write a goal spec for X', 'draft a goal for X', 'design a goal with evidence', or wants a goal doc that will actually drive agents to a green-PR outcome instead of stalling halfway.\"\ntags: [goal, spec, evidence, green-pr, code-quality, outcome-driven, history, memory]\ntriggers:\n  - \u002Fwrite-goal\n  - write a goal\n  - write a goal spec\n  - draft a goal\n  - design a goal\n  - goal with evidence\n  - goal spec for\n  - write me a goal\ncategory: workflow\nrelated_skills:\n  - finish-the-job\n  - drive-pr-to-green\n  - always-pr-never-local-edit\n  - evidence-standards\n  - pr-green-definition\n  - session-history-search\n  - memory-search\n  - ponytail\n  - root-cause-first\n  - harness\nchangelog:\n  - 1.1.0 (2026-06-28): Actually ran \u002Fhistory + \u002Fms against 6,433 Hermes sessions + 18,773 Codex threads + Claude Code JSONL. Added \"Ground truth\" section with real pattern counts (Skeptic QA 3,305 threads, Green CI 1,014 threads, \u002Fharness only 1 session in 30d). Added Phase 2.5 (\u002Frepro for bug-shaped goals). Added audit-grounded goal shapes (verify-completion, meta-goal, design\u002Fevaluate). Added 8 design decisions grounded in verbatim user goals from last month. Added mem0 memory findings.\n  - 1.0.0 (2026-06-28): Initial skill — mines last 30d of coding-CLI convos + memory, writes a structured outcome-driven goal spec wired for evidence\u002Fgreen-CI\u002Fquality. Output compatible with \u002Fgoal_harness and \u002Ffinish-the-job.\n---\n\n# write-goal\n\n**Write a goal spec that drives agents to verifiable outcomes — solid evidence, green CI PRs, high code quality — grounded in your actual coding history, not invented acceptance criteria.**\n\n## Why this skill exists\n\nThree failure modes that keep recurring in the user's last month of coding-CLI sessions (May 22 → June 28, 2026):\n\n1. **Vague goal → vague outcome.** Goal written as \"fix the cold-start bug\" produces an investigation summary, not a merged PR. No verifiable end-state is named up front, so the agent ships a write-up and stops.\n2. **No evidence contract.** Goal says \"make it work\" but never says which evidence layer counts. Agent posts a green claim without verifying current-head CI green and no merge conflicts — `gh pr checks` alone can report stale passes or miss merge conflicts.\n3. **No project-specific quality bar.** Goal omits the repo's own adversarial gates (ZFC, ZFC-leveling, root-cause-first, \u002Fes, \u002Fer). The agent thinks lint + unit tests are \"done\" and the user has to redo the work in a follow-up PR.\n\n**The fix:** mine the last 30 days of coding-CLI convos + memory for the real failure shape and the real success shape on this codebase, then write a goal spec that encodes the specific evidence artifacts, CI gates, and quality checks the agent must produce. The goal becomes a contract the agent can drive itself against — `\u002Fh`, `\u002Fa`, `\u002Ffinish` all consume it.\n\n## When to load this skill\n\n- User types `\u002Fwrite-goal \u003Ctopic>`, or natural-language equivalent (\"write a goal spec for X\", \"draft a goal that …\")\n- User asks for a goal to be designed with explicit evidence + green-CI + quality requirements\n- User wants to take an ambiguous ask (\"ship the new campaign wizard step\") and turn it into a contract the next agent (or `\u002Fh` loop) can execute against\n\n## Pipeline (execute all phases in order; no optional skips)\n\n### Phase 1 — Intake (≤1 turn)\n\nCollect the goal topic and any constraints. If the user gave the topic as `$ARGUMENTS`, use that verbatim. Otherwise ask ONE consolidate question:\n\n> What's the one outcome you want — the verifiable end-state (merged PR URL, verified local behavior, deployed service), not an activity?\n\n**Capture as inputs (write to a scratchpad, not the goal file yet):**\n- `topic` — the noun at the center (a feature, a bug class, an infra change)\n- `scope` — repo(s) \u002F file(s) \u002F surface(s) in scope\n- `outcome_shape` — one of: `green-pr-merged`, `pr-open-green`, `local-state-verified`, `dry-run-on-machine` (these are the four provable end-states from `finish-the-job` — never invent a fifth)\n- `hard_constraints` — anything the user named (no API keys in code, ≤N tokens, must keep feature flag X off, etc.)\n\n**If the user typed `\u002Fwrite-goal \u003Ctopic>` with no constraints at all → make the call yourself per the user's standing rule (finish-the-job § Anti-patterns: \"correct but misinterpret is fine\"), do not block on Phase 1 questions.**\n\n### Phase 2 — Mine the last 30 days of coding-CLI history (mandatory)\n\nPull the user's actual coding history so the goal is grounded. Run two parallel searches:\n\n**A. History search (cross-CLI)** — invoke `\u002Fhistory \u003Ctopic> --recent 30 --limit 20`. Sources it covers (per `~\u002F.claude\u002Fskills\u002Fhistory-search\u002FSKILL.md`):\n- Claude Code: `~\u002F.claude\u002Fprojects\u002F*\u002F*.jsonl`\n- Codex: `~\u002F.codex\u002Fstate_5.sqlite` threads\n- Hermes: `~\u002F.hermes\u002Fstate.db` messages (FTS5)\n\n**What to extract from the history results:**\n- **Prior attempts on this topic** — what was tried, what failed, what shape the failure took (test red, CI timeout, reviewer CHANGES_REQUESTED, agent stopped halfway, etc.)\n- **The real success shape on this codebase** — was \"done\" last time a merged PR + CI log, a screenshot + `\u002Fer` verdict, or a local run output? Capture the exact artifact type.\n- **Pitfalls this repo has hit before** — merge conflicts on the same files, flaky tests, quick \"looks green\" false positives, deny-list patterns from `adoptive-external-agent-convention` if the user has needed it.\n- **The specific checks this repo runs** — note any CI workflow names, \u002Fes \u002Fer \u002Fcode_standards invocation patterns that appear in past sessions.\n\n**B. Memory search** — invoke `\u002Fms \u003Ctopic> --recent 30 --source beads --limit 5` (and a second `\u002Fms \u003Ctopic> --source hermes --limit 5` if beads is sparse). Pull:\n- User preferences (e.g. `(h)` no parallel PRs, `(i)` centralize repeated frontend strings as constants, `(j)` thread-roadmap cadence)\n- Environment facts (Node 22, gog CLI, Hermes deploy pipeline, launchd plist rules, gh dual-bucket fallback)\n- Tool quirks (`gh pr checks` can report stale passes—use `statusCheckRollup` + `mergeable` check for 2-gate `\u002Fgreen`, `.beads\u002Fissues.jsonl` is huge—use `br`, etc.)\n- Past failures with the same shape — these become the \"Pitfalls\" section in the goal.\n\n**If both history and memory return nothing** → say so explicitly in the goal doc's \"Prior Context\" section: \"No prior CLI sessions or memory entries matched `\u003Ctopic>` in the last 30 days. Goal spec written from the user's input only; first run — pitfalls to be discovered during execution.\"\n\n### Phase 2.5 — Bug-shaped goals: run \u002Frepro first (if applicable)\n\nFrom the 30-day audit: 319 of 6,433 Hermes sessions were test\u002Frepro sessions. When the goal is bug-shaped (\"X isn't working\", \"Y is broken\", \"Z is failing\"), add a \"\u002Frepro step before Phase 3:\n\n- Load the `repro` skill (or `repro-twin-clone-evidence` skill for your-project.com)\n- Reproduce the bug FIRST — get the actual error\u002Ffailure output — Before writing the goal doc\n- Put the repro output into the \"Prior context\" section of the goal\n\n**Skip this for:** design goals, green-PR goals on existing branches, feature implementation goals, infra goals. Only bug-shaped goals need repro first.\n\n### Phase 3 — Select the outcome contract (one decision)\n\nPick the ONE end-state the agent must provably reach, drawing on Phase 2's history:\n\n**Additional goal shapes from the audit** (map to the existing 4 states):\n- *\"Did X merge?\"* \u002F *\"Is X finished?\"* → `local-state-verified` (verify with `gh pr view` \u002F `git log`, not a new PR)\n- *\"Design\u002Fevaluate a plan for X\"* → `dry-run-on-machine` (the design doc IS the artifact; the user will execute if they approve)\n- *\"Fix the harness\u002Fskill behavior\"* → `green-pr-merged` if a code fix is needed, `local-state-verified` if only a config\u002Fskill file changed\n- *\"Why aren't these PRs green?\"* → `pr-open-green` (drive the existing PR to green, not a new PR)\n\n| Outcome shape | When to pick | Required proof artifact |\n|---|---|---|\n| **green-pr-merged** | Default for code changes that touch production paths | `gh pr view \u003CN> --json state` = `MERGED` (verified at current-head SHA with CI green + no merge conflicts; `\u002Fer` verdicts are advisory) + Layer-2 evidence (env-preferences rule: unit-only is INSUFFICIENT for production changes) |\n| **pr-open-green** | When the user must do the merge (e.g. protected branch, auth gate) | `gh pr view \u003CN> --json statusCheckRollup,mergeable` shows `mergeable == MERGEABLE` + success-only, null-safe current-head `statusCheckRollup[]` (0 non-success checks excluding exact advisory `Green Gate` and `Cursor Bugbot`; reviewDecision, mergeStateStatus advisory only) + one-line blocker the user must clear |\n| **local-state-verified** | For non-PR changes (config, ops, infra) | `git diff --stat` + `git log --oneline -3` + actual command output captured in the final reply (described = fail; shown = pass) |\n| **dry-run-on-machine** | For risky migrations \u002F destructive changes the user will execute | Exact pasteable commands run against a fresh worktree, output captured, user can paste and get the same result |\n\n**Never invent a fifth outcome shape.** finish-the-job's contract has four; this skill stays inside that.\n\n### Phase 4 — Write the goal spec (the deliverable)\n\nWrite the goal to `.converge\u002Fgoal.md` in the session's cwd (the path `\u002Fgoal_harness` reads). Use the template at `templates\u002Fgoal-spec.md` — copy it and fill in every field. **All fields are mandatory; `\u003CTBD>` is a fail.** The template contents:\n\n```markdown\n# Goal: \u003Ctopic>\n\n## Outcome (verifiable, single end-state)\n\u003CONE of: green-pr-merged | pr-open-green | local-state-verified | dry-run-on-machine>\n\n### Proof artifact\n\u003Cexact artifact the agent must produce at completion — e.g. \"PR #N on $GITHUB_REPOSITORY merged with current-head CI green + no merge conflicts, \u002Fer PASS verdict (advisory), screenshot of \u002Fcampaigns\u002Fnew after merge\">\n\n## Scope\n- Repo(s): \u003Cowner\u002Frepo>\n- Files \u002F surfaces: \u003Cpaths or feature areas>\n- Out of scope: \u003Cwhat the agent must NOT touch — protects against scope creep>\n\n## Hard constraints (non-negotiable)\n- \u003Ceach constraint the user named or that's encoded in memory — e.g. \"no parallel PRs; push onto existing PR's head branch if one exists\", \"centralize new strings in frontend_constants.ts\", \"no ANTHROPIC_API_KEY in ai_universe backend\", \"use nvm Node 22, never Homebrew node\">\n\n## Evidence required\n- Layer: **Layer 2 integration minimum** (env-preferences rule — unit-only is INSUFFICIENT for production changes; \u003C100 delta lines of non-test code is the only unit-only exception)\n- Artifacts:\n  - \u003Ce.g. \"real callstack log showing the fix path is hit, mock only at external API boundaries\">\n  - \u003Ce.g. \"browser screenshot of the user-facing surface after deploy\">\n  - \u003Ce.g. \"\u002Fer verdict URL from evidence review\">\n- Forbidden:\n  - Bullet list of command names only (proof-before-claim rule)\n  - \"Key output observed: dependency install completed\" (fabrication pattern)\n  - Green claim without verifying current-head CI green and no merge conflicts (env-preferences rule)\n  - `\u003C60s` completion claim on a multi-step I\u002FO task (proof-before-claim)\n\n## Green-CI definition (specific to this repo)\n- Canonical \u002Fgreen 2-gate definition (current-head SHA):\n  - Gate 1: CI green — every CI check at HEAD passes (`statusCheckRollup` 0 non-success checks, excluding advisory `Green Gate` and `Cursor Bugbot` only)\n  - Gate 2: No merge conflicts — `mergeable == MERGEABLE`\n- Green Gate workflow logs are advisory only and are not aggregate `\u002Fgreen` proof.\n- CodeRabbit\u002FBugbot and review feedback remain optional advisory checks and do not block `\u002Fgreen`.\n- Failure on CI or merge conflicts = iterate the fix, push to PR head branch (pr-ci-fix-autopush rule: push without being asked), re-check. Do NOT report \"fixed\" until the new head SHA shows both gates PASS.\n\n## Quality bar (adversarial gates this repo uses)\nRun all of these at completion (from \u002Fgoal_harness):\n- **\u002Fes** — Evidence Standards (both ~\u002F.claude\u002Fskills\u002Fevidence-standards\u002FSKILL.md AND .claude\u002Fskills\u002Fevidence-standards.md if the repo has one)\n- **\u002Fer** — Evidence Review (adversarial, independent reviewer)\n- **\u002Fcode_standards** — 3 parallel lanes:\n  - ZFC (zero-framework cognition) — no keyword routing, no regex intent detection, no hand-tuned scoring\n  - ZFC-leveling — no level-up fields leaking into non-leveled surfaces\n  - root-cause-first — prompt\u002Fschema fixes tried before backend protection; document why if backend enforcement is added\n- **Independent Agent Review** — full-diff code review by an isolated subagent\n- 4\u002F4 PASS = DONE. Any FAIL = fix & loop. Same score 2 iterations = STALLED → escalate to human.\n\n## Dispatch routing\n- Inline if: single tool call OR tight sequence with no fork, \u003C10 lines changed\n- AO worker (`ao spawn` via dispatch-task) if: multi-step code work, PR creation, worktree isolation needed, CI iteration loop\n- `\u002Fh` (goal_harness) if: user wants the full 4-gate adversarial loop to wave the goal in\n- `\u002Fa` (finish-the-job) if: user wants hands-off single-task drive to the end-state\n- Do NOT self-execute anything that crosses the write\u002FPR threshold inline (SOUL.md scope-pivot-to-ao commit)\n\n## Definition of Done\nAt the end, the agent's final reply MUST contain (finish-the-job Phase 4):\n1. End-state declaration: \"✅ Done: \u003Cgreen PR #N merged> | \u003CPR #N open + green, awaiting your review> | \u003Clocal state X verified> | \u003Cdry-run output captured>\"\n2. Proof artifact: PR URL as markdown hyperlink `[#\u003CN>](https:\u002F\u002Fgithub.com\u002F\u003Cowner>\u002F\u003Crepo>\u002Fpull\u002F\u003CN>)` — never bare `#N` (pr-hyperlink rule)\n3. Mid-stream judgment calls: every decision the agent made instead of asking, with one-line rationale\n4. NO follow-up question — \"want me to X?\" is a violation\n\n## Pitfalls (mined from history — Phase 2)\n- \u003Cpitfall 1 — e.g. \"PR mergeability flipped to CONFLICTING after main branch updated — re-verify mergeable status at current HEAD\">\n- \u003Cpitfall 2 — e.g. \"merge conflicts on world_logic.py recur because it's a 421KB file — always pull --rebase before push\">\n- \u003Cpitfall 3 — e.g. \"Quick `looks green` false positive — must verify current-head statusCheckRollup, not `gh pr checks` conclusion\">\n- \u003Cpitfall 4 — e.g. \"Unit tests pass but Layer 2 integration fails — env-preferences says unit-only is INSUFFICIENT for production changes\">\n\n## Prior context (Phase 2 output summary)\n- History searches: \u003Ccount> sessions matched \"\u003Ctopic>\" in last 30 days\n- Memory searches: \u003Ccount> matching entries (beads + hermes)\n- Key findings:\n  - \u003Cfinding 1 — e.g. \"PR #7832 hit the same file in May 23 session; same fix shape applies\">\n  - \u003Cfinding 2>\n- If no prior context: state explicitly \"No prior CLI sessions or memory matched; first run on this topic.\"\n\n## Hand-off\n- Goal file written to: `.converge\u002Fgoal.md` (this file)\n- To execute: `\u002Fh` (run \u002Fgoal_harness against this goal) — or `\u002Fa` for hands-off single-task drive — or `ao spawn` via dispatch-task for raw worker dispatch\n- This goal spec is consumable by finish-the-job, goal_harness, and dark-factory — all three read `.converge\u002Fgoal.md`\n```\n\n### Phase 5 — Quality scaffold the spec (mandatory self-check)\n\nBefore declaring the goal written, run these gates on your own draft:\n\n1. **Outcome verifiability** — is the \"Outcome\" line ONE of the four named end-states, with a concrete artifact? If it says \"improve\" \u002F \"address\" \u002F \"investigate\" \u002F \"explore\" — rewrite it. Those are activities, not outcomes.\n2. **Evidence specificity** — does \"Evidence required\" name the actual artifact (file:line, PR URL, screenshot path, log excerpt), not a category (\"tests\", \"logs\")?\n3. **Green-CI grounded** — does \"Green-CI definition\" list this repo's actual workflow names from Phase 2? If Phase 2 found none, write \"first run — gates to be enumerated from `gh run list --workflow` on first execution\" instead of inventing gate names.\n4. **Pitfalls sourced** — does every \"Pitfalls\" entry cite a real Phase 2 finding (date, session id, or memory key)? Invented pitfalls are fabrication — strike them.\n5. **Definition of Done includes the no-follow-up rule** — verbatim: \"NO follow-up question\" appears in the DoD section.\n6. **Dispatch routing references the real commits** — does it cite `scope-pivot-to-ao` \u002F `pr-green-dispatch` so a worker reading the goal knows when to escalate inline→AO?\n\n**If any gate fails → rewrite the goal section in question. Do not post a half-spec.**\n\n### Phase 6 — Hand off (final reply)\n\nPost a single reply containing:\n\n1. **Goal spec path** — `~\u002F.converge\u002Fgoal.md` (or repo-local `.converge\u002Fgoal.md`) as an absolute path with `file:\u002F\u002F` scheme (env-preferences rule)\n2. **One-line outcome summary** — what the agent drives toward\n3. **Provenance** — how many history + memory entries fed the spec, dated\n4. **Hand-off command** — one of:\n   - `\u002Fh` — to run the full adversarial 4-gate loop (`\u002Fgoal_harness`)\n   - `\u002Fa \u003Ctopic>` — hands-off single-task drive (`finish-the-job`)\n   - `ao spawn --task \"$(cat .converge\u002Fgoal.md)\"` — raw worker dispatch\n   - `gh issue create --title \"\u003Ctopic>\" --body-file .converge\u002Fgoal.md` — issue-track the goal for babysitting\n5. **What was decided mid-stream** — any judgment call you made (which outcome shape, which gates to include, which pitfalls to surface)\n6. **NO follow-up question** — finish-the-job's final-reply contract applies here too\n\n## Pitfalls (do NOT do these)\n\n- ❌ **Inventing acceptance criteria** — gates, workflow names, pitfall shape that don't appear in Phase 2 history are fabrication. If Phase 2 returned nothing for a field, write \"first run — to be discovered during execution\" rather than guessing.\n- ❌ **Activity-shaped outcomes** — \"improve cold start\", \"investigate the BQ gap\", \"address reviewer feedback\" are activities. Rewrite as \"PR #N merged with cold-start p50 \u003C Xs measured by \u003Cprobe> \u002F CI green + no merge conflicts \u002F \u002Fer PASS (advisory)\".\n- ❌ **Unit-only evidence for production changes** — env-preferences: unit-only is INSUFFICIENT for production changes (Layer 2 integration minimum). Only the \u003C100 delta lines of non-test code exception applies.\n- ❌ **`gh pr checks` as green proof** — env-preferences: `gh pr checks` can report stale passes; must verify current-head `statusCheckRollup` (CI green) and `mergeable == MERGEABLE` (no conflicts).\n- ❌ **Goal with no dispatch routing** — without an inline-vs-AO rule, a future agent will self-execute a 30-commit PR inline and drop it when the gateway session caps. Cite `scope-pivot-to-ao`.\n- ❌ **Goal with no \"no follow-up question\" in DoD** — finish-the-job's contract requires the agent drive to conclusion. A goal that allows \"want me to X?\" mid-stream reproduces the silent-stop pattern.\n- ❌ **Skipping Phase 2 mining** — without history+memory grounding the goal is generic; the third failure mode (vague goal → vague outcome) recurs. **Specific failure mode (2026-06-28):** substituting `session_search` (a different tool that searches message summaries) for actual `\u002Fhistory` queries against the SQLite databases. `session_search` does NOT query `state.db` or `state_5.sqlite` — it has different scope and returns different results. Phase 2 MUST use `session-history-search` to query the actual session stores with the SQL patterns documented in that skill.\n- ❌ **Writing project-specific workflow names into the skill itself** — the SKILL.md stays general; the workflow names live in the generated `.converge\u002Fgoal.md`. The skill is reusable across repos.\n- ❌ **Bare `#N` PR references** — pr-hyperlink rule: every PR number in the goal doc itself and in the final reply must be a markdown hyperlink.\n\n## Verification (the skill works when…)\n\n- ✅ Generated `.converge\u002Fgoal.md` has all template fields filled (no `\u003CTBD>`)\n- ✅ Outcome line is one of the four named end-states with a concrete proof artifact\n- ✅ At least one Pitfalls entry cites a real Phase 2 finding (session id, date, or memory key)\n- ✅ Green-CI definition either lists real workflow names from history OR explicitly says \"first run\"\n- ✅ DoD section contains \"NO follow-up question\" verbatim\n- ✅ Final reply paths use the `file:\u002F\u002F` absolute-path scheme for the goal doc\n- ✅ A future session invoking `\u002Fh` or `\u002Fa` against the goal produces a green-PR-merged (or other end-state) outcome without needing a mid-stream clarifying question\n\n## Related skills — load order when this fires\n\n1. `session-history-search` (Phase 2A — `\u002Fhistory` invocation)\n2. `memory-search` (Phase 2B — `\u002Fms` invocation)\n3. `finish-the-job` (the end-state contract the goal spec plugs into)\n4. `drive-pr-to-green` (Phase 3 green-pr-merged outcome shape)\n5. `evidence-standards` (Phase 4 evidence-requirements section — load to know what counts as evidence)\n6. `pr-green-definition` (Phase 4 green-CI section — canonical 2-gate PR green definition: CI green + no merge conflicts)\n7. `ponytail` (Phase 4 quality bar — referenced by \u002Fcode_standards)\n8. `root-cause-first` (Phase 4 quality bar — referenced by \u002Fcode_standards)\n9. `harness` (Phase 6 hand-off — if user picks `\u002Fh`)\n\n## Ground truth — 30-day history audit (2026-06-28)\n\nRan `\u002Fhistory` + `\u002Fms` against all three session stores on 2026-06-28 before designing this skill. **These are the real findings that shaped the skill design.**\n\n### Data volume mined\n\n| Source | Sessions (30d) | Coding-related |\n|---|---|---|\n| Hermes (`state.db`) | 6,433 | 1,036 (title-match coding terms) |\n| Codex (`state_5.sqlite`) | ~3,500+ (150-240\u002Fday) | 18,773 total threads |\n| Claude Code (`~\u002F.claude\u002Fprojects\u002F`) | 20+ (JSONL files) | All coding |\n\n### Pattern frequency (actual counts)\n\n**Hermes sessions by title keyword:**\n- Slack\u002Finfra\u002Ftesting: 717 sessions (ack plugins, delivery verification, E2E monitors)\n- PR\u002Fgreen\u002Fmerge: 402 sessions\n- Test\u002Frepro: 319 sessions\n- Fix\u002Fbug: 122 sessions\n- Skill\u002Fskillify: 36 sessions\n- Level-up\u002FZFC: 24 sessions\n- Deploy\u002FCI: 17 sessions\n- Evidence\u002Freview: 14 sessions\n- Harness\u002Fgoal: **1 session** (underused — this skill exists to fix that)\n\n**Codex threads by first-user-message pattern:**\n- Skeptic QA Agent (adversarial review): **3,305 threads** — dominant pattern\n- Green CI verification: **1,014 threads**\n- ZFC audit: 147 threads\n- Evidence review (`\u002Fer`): 89 threads\n- Fix-gate iterations: 11 threads\n- Read-only live review: 6 threads\n- Cold plan review: 7 threads\n\n### Real user goals from the last month (verbatim from session first-messages)\n\nThese are the actual goal-shaped messages Jeffrey sent (filtered from cron\u002Ftest\u002Fping noise):\n\n1. *\"Make or find the PR where we make all local servers default to agy cli\"* — outcome: PR found\u002Fcreated, verified merged\n2. *\"did this PR truly merge and is agy_provider.py on origin main?\"* — verification goal, needs proof not activity\n3. *\"fullrun lets confirm agy cli is the default cli\"* — autonomous drive request\n4. *\"Why arent these PRs \u002Fgreen?\"* — frustration with CI blocking, needs 2-gate green fix\n5. *\"Run \u002Frepro — other people in the battle aren't taking their turns\"* — bug repro + fix\n6. *\"Lets design\u002Fevaluate a plan to convert game state json into a game state ledger\"* — design\u002Fevaluate goal, not a PR\n7. *\"Review this evidence using \u002Fer and \u002Fadvice — how do we increase parallelism?\"* — evidence review + meta question\n8. *\"Look at the test and CI failures and merge conflicts across all PRs last 48 hours\"* — triage\u002Fbabysit goal\n9. *\"cleanup merge conflicts and \u002Fgreen the PR\"* — drive-to-green goal\n10. *\"Dont do the task do the meta task. Lets read this thread and see why hermes misunderstood \u002Fgreen and run \u002Fharness\"* — meta-goal: fix the harness behavior, not just the bug\n11. *\"Is this finished? Lets do 1-4\"* — verification + drive forward\n\n### Memory findings (mem0 search)\n\n- `\"Can drive agents toward outcomes with solid evidence, and values high code quality and green CI PRs\"` (score 0.82)\n- `\"Can identify anti-patterns in agent behavior\"` (score 0.71)\n- `\"Likes designing and evaluating plans\"` (score 0.65)\n- `\"Can make drive decisions autonomously\"` (score 0.66)\n- `\"Prefers to present options and let the user respond\"` — BUT finish-the-job overrides this for execution\n\n### Design decisions grounded in the audit\n\n1. **Goal shapes must include \"verify completion\"** — goal #2 (\"did this PR merge?\") and #11 (\"Is this finished?\") are verification goals, not code goals. The existing 4-state contract handles this via `local-state-verified` but the skill should explicitly call it out.\n\n2. **Meta-goals are real** — goal #10 (\"Dont do the task do the meta task\") is a harness-fix, not a code-fix. The skill must handle meta-goal shapes (fix the harness\u002Fskill\u002Fagent behavior, not the code).\n\n3. **Evidence review is the dominant adversarial pattern** (3,305 Codex threads). The skill must wire evidence deeply — not just \"run tests\" but route to the actual Skeptic QA Agent + \u002Fer pipeline the user already uses.\n\n4. **Green verification is a top-3 activity** (1,014 Codex threads). The skill must encode the canonical 2-gate green procedure (current-head CI green via `statusCheckRollup` + no merge conflicts via `mergeable`, with review feedback treated as advisory).\n\n5. **\u002Fharness is severely underused** (1 session in 30 days). This skill should make it easy to produce goal specs that feed `\u002Fh`, increasing harness adoption.\n\n6. **Repro\u002Ftesting patterns are common** (319 sessions). The skill should know when a goal needs `\u002Frepro` as a Phase-1 step (bug-shaped goals, not feature-shaped).\n\n7. **Design\u002Fevaluate goals are valid** — goal #6 (\"design\u002Fevaluate a plan\") doesn't produce a PR. The skill must support `dry-run-on-machine` as a valid outcome for architecture\u002Fdesign goals.\n\n8. **The user's actual phrasing is casual and outcome-oriented** — not formal (\"fix the thing\", \"did this merge?\", \"why aren't these green\"). The skill must accept informal phrasing and translate to the structured contract.\n\n## Worked example — 2026-06-28 (this session)\n\nUser invoked `\u002Fwrite-goal` after a month of recurring CI\u002Fdeploy issues that never shipped.\n\n- **Phase 1 intake:** topic = \"fix the auto-deploy precompute OOM\", outcome_shape = `green-pr-merged`, scope = `$GITHUB_REPOSITORY` (embed pipeline), hard_constraints = \"no parallel PRs; if PR #7880 is open, push onto its head branch\".\n- **Phase 2 mining:** `\u002Fhistory \"precompute OOM\"` returned 3 Slack sessions + 1 CLI session; `\u002Fms \"embed batch size\"` surfaced the recipe doc at `~\u002F.hermes\u002Fskills\u002Fworldarchitect\u002Freferences\u002Fauto-deploy-dev-precompute-oom-investigation.md` and `~\u002F.hermes\u002Fskills\u002Fdevops\u002Fproduction-vs-main-drift\u002Freferences\u002Fprecompute-oom-deploy-workflow-2026-06-23.md`. Findings: prior sessions diagnosed + wrote a fix recipe but never pushed to main; deploy has been failing 80+ days.\n- **Phase 3:** outcome_shape = `green-pr-merged` (the recipe is a destructive change to `_embed_texts`; user wants it on main, not a worktree dry-run).\n- **Phase 4:** goal doc names the exact EMBED_BATCH_SIZE change, the deploy.sh exit-137 detection, the current-head CI requirements, and the prior-failure pitfalls (recipe written twice, never pushed).\n- **Phase 5:** quality scaffold passes — outcome is verifiable, evidence is Layer 2 (real callstack on embed path), gates named from history, pitfalls cite session ids.\n- **Phase 6:** reply posts `file:\u002F\u002F...\u002F.converge\u002Fgoal.md` + hands off `\u002Fh precompute OOM fix` or `ao spawn --task \"$(cat .converge\u002Fgoal.md)\"`.\n\nThe goal became the input for the `\u002Fharness` (or `\u002Fa`) loop that finally drove the fix to a merged PR — closing the 80-day failure the user identified in SOUL.md `COMMIT: diagnosis-with-fix-not-shipped`.\n","# write-goal\n\n**Write a goal spec that drives agents to verifiable outcomes — solid evidence, green CI PRs, high code quality — grounded in your actual coding history, not invented acceptance criteria.**\n\n## Why this skill exists\n\nThree failure modes that keep recurring in the user's last month of coding-CLI sessions (May 22 → June 28, 2026):\n\n1. **Vague goal → vague outcome.** Goal written as \"fix the cold-start bug\" produces an investigation summary, not a merged PR. No verifiable end-state is named up front, so the agent ships a write-up and stops.\n2. **No evidence contract.** Goal says \"make it work\" but never says which evidence layer counts. Agent posts a green claim without verifying current-head CI green and no merge conflicts — `gh pr checks` alone can report stale passes or miss merge conflicts.\n3. **No project-specific quality bar.** Goal omits the repo's own adversarial gates (ZFC, ZFC-leveling, root-cause-first, \u002Fes, \u002Fer). The agent thinks lint + unit tests are \"done\" and the user has to redo the work in a follow-up PR.\n\n**The fix:** mine the last 30 days of coding-CLI convos + memory for the real failure shape and the real success shape on this codebase, then write a goal spec that encodes the specific evidence artifacts, CI gates, and quality checks the agent must produce. The goal becomes a contract the agent can drive itself against — `\u002Fh`, `\u002Fa`, `\u002Ffinish` all consume it.\n\n## When to load this skill\n\n- User types `\u002Fwrite-goal \u003Ctopic>`, or natural-language equivalent (\"write a goal spec for X\", \"draft a goal that …\")\n- User asks for a goal to be designed with explicit evidence + green-CI + quality requirements\n- User wants to take an ambiguous ask (\"ship the new campaign wizard step\") and turn it into a contract the next agent (or `\u002Fh` loop) can execute against\n\n## Pipeline (execute all phases in order; no optional skips)\n\n### Phase 1 — Intake (≤1 turn)\n\nCollect the goal topic and any constraints. If the user gave the topic as `$ARGUMENTS`, use that verbatim. Otherwise ask ONE consolidate question:\n\n> What's the one outcome you want — the verifiable end-state (merged PR URL, verified local behavior, deployed service), not an activity?\n\n**Capture as inputs (write to a scratchpad, not the goal file yet):**\n- `topic` — the noun at the center (a feature, a bug class, an infra change)\n- `scope` — repo(s) \u002F file(s) \u002F surface(s) in scope\n- `outcome_shape` — one of: `green-pr-merged`, `pr-open-green`, `local-state-verified`, `dry-run-on-machine` (these are the four provable end-states from `finish-the-job` — never invent a fifth)\n- `hard_constraints` — anything the user named (no API keys in code, ≤N tokens, must keep feature flag X off, etc.)\n\n**If the user typed `\u002Fwrite-goal \u003Ctopic>` with no constraints at all → make the call yourself per the user's standing rule (finish-the-job § Anti-patterns: \"correct but misinterpret is fine\"), do not block on Phase 1 questions.**\n\n### Phase 2 — Mine the last 30 days of coding-CLI history (mandatory)\n\nPull the user's actual coding history so the goal is grounded. Run two parallel searches:\n\n**A. History search (cross-CLI)** — invoke `\u002Fhistory \u003Ctopic> --recent 30 --limit 20`. Sources it covers (per `~\u002F.claude\u002Fskills\u002Fhistory-search\u002FSKILL.md`):\n- Claude Code: `~\u002F.claude\u002Fprojects\u002F*\u002F*.jsonl`\n- Codex: `~\u002F.codex\u002Fstate_5.sqlite` threads\n- Hermes: `~\u002F.hermes\u002Fstate.db` messages (FTS5)\n\n**What to extract from the history results:**\n- **Prior attempts on this topic** — what was tried, what failed, what shape the failure took (test red, CI timeout, reviewer CHANGES_REQUESTED, agent stopped halfway, etc.)\n- **The real success shape on this codebase** — was \"done\" last time a merged PR + CI log, a screenshot + `\u002Fer` verdict, or a local run output? Capture the exact artifact type.\n- **Pitfalls this repo has hit before** — merge conflicts on the same files, flaky tests, quick \"looks green\" false positives, deny-list patterns from `adoptive-external-agent-convention` if the user has needed it.\n- **The specific checks this repo runs** — note any CI workflow names, \u002Fes \u002Fer \u002Fcode_standards invocation patterns that appear in past sessions.\n\n**B. Memory search** — invoke `\u002Fms \u003Ctopic> --recent 30 --source beads --limit 5` (and a second `\u002Fms \u003Ctopic> --source hermes --limit 5` if beads is sparse). Pull:\n- User preferences (e.g. `(h)` no parallel PRs, `(i)` centralize repeated frontend strings as constants, `(j)` thread-roadmap cadence)\n- Environment facts (Node 22, gog CLI, Hermes deploy pipeline, launchd plist rules, gh dual-bucket fallback)\n- Tool quirks (`gh pr checks` can report stale passes—use `statusCheckRollup` + `mergeable` check for 2-gate `\u002Fgreen`, `.beads\u002Fissues.jsonl` is huge—use `br`, etc.)\n- Past failures with the same shape — these become the \"Pitfalls\" section in the goal.\n\n**If both history and memory return nothing** → say so explicitly in the goal doc's \"Prior Context\" section: \"No prior CLI sessions or memory entries matched `\u003Ctopic>` in the last 30 days. Goal spec written from the user's input only; first run — pitfalls to be discovered during execution.\"\n\n### Phase 2.5 — Bug-shaped goals: run \u002Frepro first (if applicable)\n\nFrom the 30-day audit: 319 of 6,433 Hermes sessions were test\u002Frepro sessions. When the goal is bug-shaped (\"X isn't working\", \"Y is broken\", \"Z is failing\"), add a \"\u002Frepro step before Phase 3:\n\n- Load the `repro` skill (or `repro-twin-clone-evidence` skill for your-project.com)\n- Reproduce the bug FIRST — get the actual error\u002Ffailure output — Before writing the goal doc\n- Put the repro output into the \"Prior context\" section of the goal\n\n**Skip this for:** design goals, green-PR goals on existing branches, feature implementation goals, infra goals. Only bug-shaped goals need repro first.\n\n### Phase 3 — Select the outcome contract (one decision)\n\nPick the ONE end-state the agent must provably reach, drawing on Phase 2's history:\n\n**Additional goal shapes from the audit** (map to the existing 4 states):\n- *\"Did X merge?\"* \u002F *\"Is X finished?\"* → `local-state-verified` (verify with `gh pr view` \u002F `git log`, not a new PR)\n- *\"Design\u002Fevaluate a plan for X\"* → `dry-run-on-machine` (the design doc IS the artifact; the user will execute if they approve)\n- *\"Fix the harness\u002Fskill behavior\"* → `green-pr-merged` if a code fix is needed, `local-state-verified` if only a config\u002Fskill file changed\n- *\"Why aren't these PRs green?\"* → `pr-open-green` (drive the existing PR to green, not a new PR)\n\n| Outcome shape | When to pick | Required proof artifact |\n|---|---|---|\n| **green-pr-merged** | Default for code changes that touch production paths | `gh pr view \u003CN> --json state` = `MERGED` (verified at current-head SHA with CI green + no merge conflicts; `\u002Fer` verdicts are advisory) + Layer-2 evidence (env-preferences rule: unit-only is INSUFFICIENT for production changes) |\n| **pr-open-green** | When the user must do the merge (e.g. protected branch, auth gate) | `gh pr view \u003CN> --json statusCheckRollup,mergeable` shows `mergeable == MERGEABLE` + success-only, null-safe current-head `statusCheckRollup[]` (0 non-success checks excluding exact advisory `Green Gate` and `Cursor Bugbot`; reviewDecision, mergeStateStatus advisory only) + one-line blocker the user must clear |\n| **local-state-verified** | For non-PR changes (config, ops, infra) | `git diff --stat` + `git log --oneline -3` + actual command output captured in the final reply (described = fail; shown = pass) |\n| **dry-run-on-machine** | For risky migrations \u002F destructive changes the user will execute | Exact pasteable commands run against a fresh worktree, output captured, user can paste and get the same result |\n\n**Never invent a fifth outcome shape.** finish-the-job's contract has four; this skill stays inside that.\n\n### Phase 4 — Write the goal spec (the deliverable)\n\nWrite the goal to `.converge\u002Fgoal.md` in the session's cwd (the path `\u002Fgoal_harness` reads). Use the template at `templates\u002Fgoal-spec.md` — copy it and fill in every field. **All fields are mandatory; `\u003CTBD>` is a fail.** The template contents:\n\n```markdown\n# Goal: \u003Ctopic>\n\n## Outcome (verifiable, single end-state)\n\u003CONE of: green-pr-merged | pr-open-green | local-state-verified | dry-run-on-machine>\n\n### Proof artifact\n\u003Cexact artifact the agent must produce at completion — e.g. \"PR #N on $GITHUB_REPOSITORY merged with current-head CI green + no merge conflicts, \u002Fer PASS verdict (advisory), screenshot of \u002Fcampaigns\u002Fnew after merge\">\n\n## Scope\n- Repo(s): \u003Cowner\u002Frepo>\n- Files \u002F surfaces: \u003Cpaths or feature areas>\n- Out of scope: \u003Cwhat the agent must NOT touch — protects against scope creep>\n\n## Hard constraints (non-negotiable)\n- \u003Ceach constraint the user named or that's encoded in memory — e.g. \"no parallel PRs; push onto existing PR's head branch if one exists\", \"centralize new strings in frontend_constants.ts\", \"no ANTHROPIC_API_KEY in ai_universe backend\", \"use nvm Node 22, never Homebrew node\">\n\n## Evidence required\n- Layer: **Layer 2 integration minimum** (env-preferences rule — unit-only is INSUFFICIENT for production changes; \u003C100 delta lines of non-test code is the only unit-only exception)\n- Artifacts:\n  - \u003Ce.g. \"real callstack log showing the fix path is hit, mock only at external API boundaries\">\n  - \u003Ce.g. \"browser screenshot of the user-facing surface after deploy\">\n  - \u003Ce.g. \"\u002Fer verdict URL from evidence review\">\n- Forbidden:\n  - Bullet list of command names only (proof-before-claim rule)\n  - \"Key output observed: dependency install completed\" (fabrication pattern)\n  - Green claim without verifying current-head CI green and no merge conflicts (env-preferences rule)\n  - `\u003C60s` completion claim on a multi-step I\u002FO task (proof-before-claim)\n\n## Green-CI definition (specific to this repo)\n- Canonical \u002Fgreen 2-gate definition (current-head SHA):\n  - Gate 1: CI green — every CI check at HEAD passes (`statusCheckRollup` 0 non-success checks, excluding advisory `Green Gate` and `Cursor Bugbot` only)\n  - Gate 2: No merge conflicts — `mergeable == MERGEABLE`\n- Green Gate workflow logs are advisory only and are not aggregate `\u002Fgreen` proof.\n- CodeRabbit\u002FBugbot and review feedback remain optional advisory checks and do not block `\u002Fgreen`.\n- Failure on CI or merge conflicts = iterate the fix, push to PR head branch (pr-ci-fix-autopush rule: push without being asked), re-check. Do NOT report \"fixed\" until the new head SHA shows both gates PASS.\n\n## Quality bar (adversarial gates this repo uses)\nRun all of these at completion (from \u002Fgoal_harness):\n- **\u002Fes** — Evidence Standards (both ~\u002F.claude\u002Fskills\u002Fevidence-standards\u002FSKILL.md AND .claude\u002Fskills\u002Fevidence-standards.md if the repo has one)\n- **\u002Fer** — Evidence Review (adversarial, independent reviewer)\n- **\u002Fcode_standards** — 3 parallel lanes:\n  - ZFC (zero-framework cognition) — no keyword routing, no regex intent detection, no hand-tuned scoring\n  - ZFC-leveling — no level-up fields leaking into non-leveled surfaces\n  - root-cause-first — prompt\u002Fschema fixes tried before backend protection; document why if backend enforcement is added\n- **Independent Agent Review** — full-diff code review by an isolated subagent\n- 4\u002F4 PASS = DONE. Any FAIL = fix & loop. Same score 2 iterations = STALLED → escalate to human.\n\n## Dispatch routing\n- Inline if: single tool call OR tight sequence with no fork, \u003C10 lines changed\n- AO worker (`ao spawn` via dispatch-task) if: multi-step code work, PR creation, worktree isolation needed, CI iteration loop\n- `\u002Fh` (goal_harness) if: user wants the full 4-gate adversarial loop to wave the goal in\n- `\u002Fa` (finish-the-job) if: user wants hands-off single-task drive to the end-state\n- Do NOT self-execute anything that crosses the write\u002FPR threshold inline (SOUL.md scope-pivot-to-ao commit)\n\n## Definition of Done\nAt the end, the agent's final reply MUST contain (finish-the-job Phase 4):\n1. End-state declaration: \"✅ Done: \u003Cgreen PR #N merged> | \u003CPR #N open + green, awaiting your review> | \u003Clocal state X verified> | \u003Cdry-run output captured>\"\n2. Proof artifact: PR URL as markdown hyperlink `[#\u003CN>](https:\u002F\u002Fgithub.com\u002F\u003Cowner>\u002F\u003Crepo>\u002Fpull\u002F\u003CN>)` — never bare `#N` (pr-hyperlink rule)\n3. Mid-stream judgment calls: every decision the agent made instead of asking, with one-line rationale\n4. NO follow-up question — \"want me to X?\" is a violation\n\n## Pitfalls (mined from history — Phase 2)\n- \u003Cpitfall 1 — e.g. \"PR mergeability flipped to CONFLICTING after main branch updated — re-verify mergeable status at current HEAD\">\n- \u003Cpitfall 2 — e.g. \"merge conflicts on world_logic.py recur because it's a 421KB file — always pull --rebase before push\">\n- \u003Cpitfall 3 — e.g. \"Quick `looks green` false positive — must verify current-head statusCheckRollup, not `gh pr checks` conclusion\">\n- \u003Cpitfall 4 — e.g. \"Unit tests pass but Layer 2 integration fails — env-preferences says unit-only is INSUFFICIENT for production changes\">\n\n## Prior context (Phase 2 output summary)\n- History searches: \u003Ccount> sessions matched \"\u003Ctopic>\" in last 30 days\n- Memory searches: \u003Ccount> matching entries (beads + hermes)\n- Key findings:\n  - \u003Cfinding 1 — e.g. \"PR #7832 hit the same file in May 23 session; same fix shape applies\">\n  - \u003Cfinding 2>\n- If no prior context: state explicitly \"No prior CLI sessions or memory matched; first run on this topic.\"\n\n## Hand-off\n- Goal file written to: `.converge\u002Fgoal.md` (this file)\n- To execute: `\u002Fh` (run \u002Fgoal_harness against this goal) — or `\u002Fa` for hands-off single-task drive — or `ao spawn` via dispatch-task for raw worker dispatch\n- This goal spec is consumable by finish-the-job, goal_harness, and dark-factory — all three read `.converge\u002Fgoal.md`\n```\n\n### Phase 5 — Quality scaffold the spec (mandatory self-check)\n\nBefore declaring the goal written, run these gates on your own draft:\n\n1. **Outcome verifiability** — is the \"Outcome\" line ONE of the four named end-states, with a concrete artifact? If it says \"improve\" \u002F \"address\" \u002F \"investigate\" \u002F \"explore\" — rewrite it. Those are activities, not outcomes.\n2. **Evidence specificity** — does \"Evidence required\" name the actual artifact (file:line, PR URL, screenshot path, log excerpt), not a category (\"tests\", \"logs\")?\n3. **Green-CI grounded** — does \"Green-CI definition\" list this repo's actual workflow names from Phase 2? If Phase 2 found none, write \"first run — gates to be enumerated from `gh run list --workflow` on first execution\" instead of inventing gate names.\n4. **Pitfalls sourced** — does every \"Pitfalls\" entry cite a real Phase 2 finding (date, session id, or memory key)? Invented pitfalls are fabrication — strike them.\n5. **Definition of Done includes the no-follow-up rule** — verbatim: \"NO follow-up question\" appears in the DoD section.\n6. **Dispatch routing references the real commits** — does it cite `scope-pivot-to-ao` \u002F `pr-green-dispatch` so a worker reading the goal knows when to escalate inline→AO?\n\n**If any gate fails → rewrite the goal section in question. Do not post a half-spec.**\n\n### Phase 6 — Hand off (final reply)\n\nPost a single reply containing:\n\n1. **Goal spec path** — `~\u002F.converge\u002Fgoal.md` (or repo-local `.converge\u002Fgoal.md`) as an absolute path with `file:\u002F\u002F` scheme (env-preferences rule)\n2. **One-line outcome summary** — what the agent drives toward\n3. **Provenance** — how many history + memory entries fed the spec, dated\n4. **Hand-off command** — one of:\n   - `\u002Fh` — to run the full adversarial 4-gate loop (`\u002Fgoal_harness`)\n   - `\u002Fa \u003Ctopic>` — hands-off single-task drive (`finish-the-job`)\n   - `ao spawn --task \"$(cat .converge\u002Fgoal.md)\"` — raw worker dispatch\n   - `gh issue create --title \"\u003Ctopic>\" --body-file .converge\u002Fgoal.md` — issue-track the goal for babysitting\n5. **What was decided mid-stream** — any judgment call you made (which outcome shape, which gates to include, which pitfalls to surface)\n6. **NO follow-up question** — finish-the-job's final-reply contract applies here too\n\n## Pitfalls (do NOT do these)\n\n- ❌ **Inventing acceptance criteria** — gates, workflow names, pitfall shape that don't appear in Phase 2 history are fabrication. If Phase 2 returned nothing for a field, write \"first run — to be discovered during execution\" rather than guessing.\n- ❌ **Activity-shaped outcomes** — \"improve cold start\", \"investigate the BQ gap\", \"address reviewer feedback\" are activities. Rewrite as \"PR #N merged with cold-start p50 \u003C Xs measured by \u003Cprobe> \u002F CI green + no merge conflicts \u002F \u002Fer PASS (advisory)\".\n- ❌ **Unit-only evidence for production changes** — env-preferences: unit-only is INSUFFICIENT for production changes (Layer 2 integration minimum). Only the \u003C100 delta lines of non-test code exception applies.\n- ❌ **`gh pr checks` as green proof** — env-preferences: `gh pr checks` can report stale passes; must verify current-head `statusCheckRollup` (CI green) and `mergeable == MERGEABLE` (no conflicts).\n- ❌ **Goal with no dispatch routing** — without an inline-vs-AO rule, a future agent will self-execute a 30-commit PR inline and drop it when the gateway session caps. Cite `scope-pivot-to-ao`.\n- ❌ **Goal with no \"no follow-up question\" in DoD** — finish-the-job's contract requires the agent drive to conclusion. A goal that allows \"want me to X?\" mid-stream reproduces the silent-stop pattern.\n- ❌ **Skipping Phase 2 mining** — without history+memory grounding the goal is generic; the third failure mode (vague goal → vague outcome) recurs. **Specific failure mode (2026-06-28):** substituting `session_search` (a different tool that searches message summaries) for actual `\u002Fhistory` queries against the SQLite databases. `session_search` does NOT query `state.db` or `state_5.sqlite` — it has different scope and returns different results. Phase 2 MUST use `session-history-search` to query the actual session stores with the SQL patterns documented in that skill.\n- ❌ **Writing project-specific workflow names into the skill itself** — the SKILL.md stays general; the workflow names live in the generated `.converge\u002Fgoal.md`. The skill is reusable across repos.\n- ❌ **Bare `#N` PR references** — pr-hyperlink rule: every PR number in the goal doc itself and in the final reply must be a markdown hyperlink.\n\n## Verification (the skill works when…)\n\n- ✅ Generated `.converge\u002Fgoal.md` has all template fields filled (no `\u003CTBD>`)\n- ✅ Outcome line is one of the four named end-states with a concrete proof artifact\n- ✅ At least one Pitfalls entry cites a real Phase 2 finding (session id, date, or memory key)\n- ✅ Green-CI definition either lists real workflow names from history OR explicitly says \"first run\"\n- ✅ DoD section contains \"NO follow-up question\" verbatim\n- ✅ Final reply paths use the `file:\u002F\u002F` absolute-path scheme for the goal doc\n- ✅ A future session invoking `\u002Fh` or `\u002Fa` against the goal produces a green-PR-merged (or other end-state) outcome without needing a mid-stream clarifying question\n\n## Related skills — load order when this fires\n\n1. `session-history-search` (Phase 2A — `\u002Fhistory` invocation)\n2. `memory-search` (Phase 2B — `\u002Fms` invocation)\n3. `finish-the-job` (the end-state contract the goal spec plugs into)\n4. `drive-pr-to-green` (Phase 3 green-pr-merged outcome shape)\n5. `evidence-standards` (Phase 4 evidence-requirements section — load to know what counts as evidence)\n6. `pr-green-definition` (Phase 4 green-CI section — canonical 2-gate PR green definition: CI green + no merge conflicts)\n7. `ponytail` (Phase 4 quality bar — referenced by \u002Fcode_standards)\n8. `root-cause-first` (Phase 4 quality bar — referenced by \u002Fcode_standards)\n9. `harness` (Phase 6 hand-off — if user picks `\u002Fh`)\n\n## Ground truth — 30-day history audit (2026-06-28)\n\nRan `\u002Fhistory` + `\u002Fms` against all three session stores on 2026-06-28 before designing this skill. **These are the real findings that shaped the skill design.**\n\n### Data volume mined\n\n| Source | Sessions (30d) | Coding-related |\n|---|---|---|\n| Hermes (`state.db`) | 6,433 | 1,036 (title-match coding terms) |\n| Codex (`state_5.sqlite`) | ~3,500+ (150-240\u002Fday) | 18,773 total threads |\n| Claude Code (`~\u002F.claude\u002Fprojects\u002F`) | 20+ (JSONL files) | All coding |\n\n### Pattern frequency (actual counts)\n\n**Hermes sessions by title keyword:**\n- Slack\u002Finfra\u002Ftesting: 717 sessions (ack plugins, delivery verification, E2E monitors)\n- PR\u002Fgreen\u002Fmerge: 402 sessions\n- Test\u002Frepro: 319 sessions\n- Fix\u002Fbug: 122 sessions\n- Skill\u002Fskillify: 36 sessions\n- Level-up\u002FZFC: 24 sessions\n- Deploy\u002FCI: 17 sessions\n- Evidence\u002Freview: 14 sessions\n- Harness\u002Fgoal: **1 session** (underused — this skill exists to fix that)\n\n**Codex threads by first-user-message pattern:**\n- Skeptic QA Agent (adversarial review): **3,305 threads** — dominant pattern\n- Green CI verification: **1,014 threads**\n- ZFC audit: 147 threads\n- Evidence review (`\u002Fer`): 89 threads\n- Fix-gate iterations: 11 threads\n- Read-only live review: 6 threads\n- Cold plan review: 7 threads\n\n### Real user goals from the last month (verbatim from session first-messages)\n\nThese are the actual goal-shaped messages Jeffrey sent (filtered from cron\u002Ftest\u002Fping noise):\n\n1. *\"Make or find the PR where we make all local servers default to agy cli\"* — outcome: PR found\u002Fcreated, verified merged\n2. *\"did this PR truly merge and is agy_provider.py on origin main?\"* — verification goal, needs proof not activity\n3. *\"fullrun lets confirm agy cli is the default cli\"* — autonomous drive request\n4. *\"Why arent these PRs \u002Fgreen?\"* — frustration with CI blocking, needs 2-gate green fix\n5. *\"Run \u002Frepro — other people in the battle aren't taking their turns\"* — bug repro + fix\n6. *\"Lets design\u002Fevaluate a plan to convert game state json into a game state ledger\"* — design\u002Fevaluate goal, not a PR\n7. *\"Review this evidence using \u002Fer and \u002Fadvice — how do we increase parallelism?\"* — evidence review + meta question\n8. *\"Look at the test and CI failures and merge conflicts across all PRs last 48 hours\"* — triage\u002Fbabysit goal\n9. *\"cleanup merge conflicts and \u002Fgreen the PR\"* — drive-to-green goal\n10. *\"Dont do the task do the meta task. Lets read this thread and see why hermes misunderstood \u002Fgreen and run \u002Fharness\"* — meta-goal: fix the harness behavior, not just the bug\n11. *\"Is this finished? Lets do 1-4\"* — verification + drive forward\n\n### Memory findings (mem0 search)\n\n- `\"Can drive agents toward outcomes with solid evidence, and values high code quality and green CI PRs\"` (score 0.82)\n- `\"Can identify anti-patterns in agent behavior\"` (score 0.71)\n- `\"Likes designing and evaluating plans\"` (score 0.65)\n- `\"Can make drive decisions autonomously\"` (score 0.66)\n- `\"Prefers to present options and let the user respond\"` — BUT finish-the-job overrides this for execution\n\n### Design decisions grounded in the audit\n\n1. **Goal shapes must include \"verify completion\"** — goal #2 (\"did this PR merge?\") and #11 (\"Is this finished?\") are verification goals, not code goals. The existing 4-state contract handles this via `local-state-verified` but the skill should explicitly call it out.\n\n2. **Meta-goals are real** — goal #10 (\"Dont do the task do the meta task\") is a harness-fix, not a code-fix. The skill must handle meta-goal shapes (fix the harness\u002Fskill\u002Fagent behavior, not the code).\n\n3. **Evidence review is the dominant adversarial pattern** (3,305 Codex threads). The skill must wire evidence deeply — not just \"run tests\" but route to the actual Skeptic QA Agent + \u002Fer pipeline the user already uses.\n\n4. **Green verification is a top-3 activity** (1,014 Codex threads). The skill must encode the canonical 2-gate green procedure (current-head CI green via `statusCheckRollup` + no merge conflicts via `mergeable`, with review feedback treated as advisory).\n\n5. **\u002Fharness is severely underused** (1 session in 30 days). This skill should make it easy to produce goal specs that feed `\u002Fh`, increasing harness adoption.\n\n6. **Repro\u002Ftesting patterns are common** (319 sessions). The skill should know when a goal needs `\u002Frepro` as a Phase-1 step (bug-shaped goals, not feature-shaped).\n\n7. **Design\u002Fevaluate goals are valid** — goal #6 (\"design\u002Fevaluate a plan\") doesn't produce a PR. The skill must support `dry-run-on-machine` as a valid outcome for architecture\u002Fdesign goals.\n\n8. **The user's actual phrasing is casual and outcome-oriented** — not formal (\"fix the thing\", \"did this merge?\", \"why aren't these green\"). The skill must accept informal phrasing and translate to the structured contract.\n\n## Worked example — 2026-06-28 (this session)\n\nUser invoked `\u002Fwrite-goal` after a month of recurring CI\u002Fdeploy issues that never shipped.\n\n- **Phase 1 intake:** topic = \"fix the auto-deploy precompute OOM\", outcome_shape = `green-pr-merged`, scope = `$GITHUB_REPOSITORY` (embed pipeline), hard_constraints = \"no parallel PRs; if PR #7880 is open, push onto its head branch\".\n- **Phase 2 mining:** `\u002Fhistory \"precompute OOM\"` returned 3 Slack sessions + 1 CLI session; `\u002Fms \"embed batch size\"` surfaced the recipe doc at `~\u002F.hermes\u002Fskills\u002Fworldarchitect\u002Freferences\u002Fauto-deploy-dev-precompute-oom-investigation.md` and `~\u002F.hermes\u002Fskills\u002Fdevops\u002Fproduction-vs-main-drift\u002Freferences\u002Fprecompute-oom-deploy-workflow-2026-06-23.md`. Findings: prior sessions diagnosed + wrote a fix recipe but never pushed to main; deploy has been failing 80+ days.\n- **Phase 3:** outcome_shape = `green-pr-merged` (the recipe is a destructive change to `_embed_texts`; user wants it on main, not a worktree dry-run).\n- **Phase 4:** goal doc names the exact EMBED_BATCH_SIZE change, the deploy.sh exit-137 detection, the current-head CI requirements, and the prior-failure pitfalls (recipe written twice, never pushed).\n- **Phase 5:** quality scaffold passes — outcome is verifiable, evidence is Layer 2 (real callstack on embed path), gates named from history, pitfalls cite session ids.\n- **Phase 6:** reply posts `file:\u002F\u002F...\u002F.converge\u002Fgoal.md` + hands off `\u002Fh precompute OOM fix` or `ao spawn --task \"$(cat .converge\u002Fgoal.md)\"`.\n\nThe goal became the input for the `\u002Fharness` (or `\u002Fa`) loop that finally drove the fix to a merged PR — closing the 80-day failure the user identified in SOUL.md `COMMIT: diagnosis-with-fix-not-shipped`.\n",{"name":5,"tags":65,"version":71,"category":56,"triggers":72,"changelog":81,"description":7,"when_to_use":86,"related_skills":87},[32,66,67,68,49,69,70,58],"spec","evidence","green-pr","outcome-driven","history","1.1.0",[73,74,75,76,77,78,79,80],"\u002Fwrite-goal","write a goal","write a goal spec","draft a goal","design a goal","goal with evidence","goal spec for","write me a goal",[82,84],{"1.1.0 (2026-06-28)":83},"Actually ran \u002Fhistory + \u002Fms against 6,433 Hermes sessions + 18,773 Codex threads + Claude Code JSONL. Added \"Ground truth\" section with real pattern counts (Skeptic QA 3,305 threads, Green CI 1,014 threads, \u002Fharness only 1 session in 30d). Added Phase 2.5 (\u002Frepro for bug-shaped goals). Added audit-grounded goal shapes (verify-completion, meta-goal, design\u002Fevaluate). Added 8 design decisions grounded in verbatim user goals from last month. Added mem0 memory findings.",{"1.0.0 (2026-06-28)":85},"Initial skill — mines last 30d of coding-CLI convos + memory, writes a structured outcome-driven goal spec wired for evidence\u002Fgreen-CI\u002Fquality. Output compatible with \u002Fgoal_harness and \u002Ffinish-the-job.","Use when the user types \u002Fwrite-goal \u003Ctopic>, asks to 'write a goal spec for X', 'draft a goal for X', 'design a goal with evidence', or wants a goal doc that will actually drive agents to a green-PR outcome instead of stalling halfway.",[88,89,90,91,92,93,94,57,95,96],"finish-the-job","drive-pr-to-green","always-pr-never-local-edit","evidence-standards","pr-green-definition","session-history-search","memory-search","root-cause-first","harness","main","42ccd02cbf5e8e47839dc3eab6fc754dc6b339cf",".claude\u002Fskills_archive\u002F2026-08-29-unused-and-redundant\u002Fwrite-goal",0,"https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills","https:\u002F\u002Fgithub.com\u002Fjleechanorg","2026-11-14 14:55:35",{"source":9,"skillName":5,"commands":105,"prompt":115,"zipAvailable":116},[106,109,112],{"tool":107,"command":108},"npx","npx skills add jleechanorg\u002Fjleechan-skills --skill write-goal",{"tool":110,"command":111},"bunx","bunx skills add jleechanorg\u002Fjleechan-skills --skill write-goal",{"tool":113,"command":114},"pnpm","pnpm dlx skills add jleechanorg\u002Fjleechan-skills --skill write-goal","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-08-29-unused-and-redundant\u002Fwrite-goal\u002FSKILL.md",true,[118],{"path":119,"resourceType":120,"resourceTypeDesc":121,"sizeBytes":122,"sourceHtmlUrl":123},"templates\u002Fgoal-spec.md","REFERENCE","参考文档",5084,"https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-08-29-unused-and-redundant\u002Fwrite-goal\u002Ftemplates\u002Fgoal-spec.md",[125,133,140,148,156,165],{"skillNo":126,"name":127,"nameZh":13,"description":128,"descriptionZh":13,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":13,"sourceHtmlUrl":129,"categories":130,"keywords":131,"publishedAt":132},"01M7DRVZXXMGY4G81K5GVF4V20","disk-reclaim-playbook","Use Disk Magician to diagnose disk growth or qualify cleanup on macOS or Linux.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fdisk-reclaim-playbook\u002FSKILL.md",[],[],"2026-11-15 14:19:17",{"skillNo":134,"name":135,"nameZh":13,"description":136,"descriptionZh":13,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":13,"sourceHtmlUrl":137,"categories":138,"keywords":139,"publishedAt":132},"01M7B63PNTT2TY78RFKHD8SP3X","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.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fclaudea-bench\u002FSKILL.md",[],[],{"skillNo":141,"name":142,"nameZh":13,"description":143,"descriptionZh":13,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":13,"sourceHtmlUrl":144,"categories":145,"keywords":146,"publishedAt":147},"01M7622KQJ32AV4K5BXEMVSSEB","pr","Alias for the canonical pr-lifecycle PR workflow skill (\u002Fpr-workflow, \u002Fprw).","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills\u002Fpr\u002FSKILL.md",[],[],"2026-11-12 13:55:43",{"skillNo":149,"name":150,"nameZh":13,"description":151,"descriptionZh":13,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":13,"sourceHtmlUrl":152,"categories":153,"keywords":154,"publishedAt":155},"01M7432W92AKC4D1TKJ00VCMMT","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.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fwhisper\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":157,"name":158,"nameZh":13,"description":159,"descriptionZh":13,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":160,"licenseFileUrl":161,"sourceHtmlUrl":162,"categories":163,"keywords":164,"publishedAt":155},"01M7432T6BN1A9SHB8RBQR5EMP","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.","Apache-2.0","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fwebapp-testing\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fwebapp-testing\u002FSKILL.md",[],[],{"skillNo":166,"name":167,"nameZh":13,"description":168,"descriptionZh":13,"repositoryFullName":9,"ownerLogin":10,"ownerAvatarUrl":11,"ownerAccountNo":12,"ownerDisplayName":13,"repositoryNo":14,"starsCount":15,"licenseSpdxId":16,"licenseFileUrl":13,"sourceHtmlUrl":169,"categories":170,"keywords":171,"publishedAt":155},"01M7432NDC7S6C6MX7M6RW8CTT","pr-report","This skill should be used when the user asks for a PR report, PR audit, PR delta analysis, \u002Fpr-report, or wants per-PR summary with delta files\u002Flines. Generates a structured report for one or more open PRs covering purpose, files changed, +\u002F− line counts, \u002Fcode-standards + \u002Fthermo review findings, \u002Fponytail simplification opportunities, file-overlap combination candidates, and \u002Fgreen status per pr-green-definition. Output: machine-readable JSONL + human-readable markdown. Read-only by default; can apply simplifications if user opts in.","https:\u002F\u002Fgithub.com\u002Fjleechanorg\u002Fjleechan-skills\u002Fblob\u002Fmain\u002F.claude\u002Fskills_archive\u002F2026-11-09-no-usage-evidence\u002Fpr-report\u002FSKILL.md",[],[]]