feat(stage7d): decode + gate + generate — the second half of setup-harness - #4
Merged
Merged
Conversation
…ness)
Completes /setup-harness from the interview record onward: classify every
rule to its enforcement tier, present the editable decomposition-table gate,
and on approval generate a tailored, self-verified harness. All machinery is
read-only until the gate; nothing enforcing is written before sign-off.
New machinery under core/setup/ (dependency-free, cross-platform Node):
- decode.mjs Classify EVERY answer + doc-derived normative statement +
adopt candidate to its tier (HOOK / LINT / RULE / FACT / SKILL)
per the rule of thumb: enforcement -> hook (git-action/content,
or a REAL lint rule at the strongest layer), procedure -> skill,
facts -> CLAUDE.md/rule, proactive tool-default -> unscoped rule.
Handles the worked-example acceptance table (em-dash, TB-####
branch, co-author ban, Confluence decompose-each, AWS/Jira
CLI/MCP) with ZERO project leakage. Conflicts (interview vs
config vs doc) are FLAGGED inline — always-ask, never
auto-resolved.
- gate.mjs Render ONE editable decomposition table (harness.decomposition.md),
parse the user's Tier/Action edits back, apply them
(enforce/soften/drop), and refuse to proceed while a conflict
is unsettled.
- generate.mjs Build every artifact from the approved rows: hooks.policy.json
(dual-target — CC hooks + opencode plugin both read it),
workflow.config.yaml, CLAUDE.md, .claude/rules/*, lint scaffolds
(strongest layer via lint-generators/), and machine-specialized
(investigate/ship) + new bespoke skills.
- adopt.mjs Adopt-vs-reset: back up an existing CLAUDE.md/hooks/rules to a
timestamped folder, then decompose the old prose into decode
candidates. Nothing lost.
- manifest.mjs The versioned harness.manifest.json — every artifact traced to
its answers rows + hashed, so a re-run/sync preserves hand-edits.
- verify.mjs Post-generation self-verify: config/policy parse, skills load,
and a guardrail DRY-RUN (a protected-branch push must BLOCK)
against the real logic core, plus a gaps report. Never throws.
Runbook setup-harness.md extended with phases 6-10 (adopt -> decode -> gate ->
generate -> self-verify), replacing the read-only STOP handoff; README + core
setup README updated; setup-harness skill description + adapters regenerated.
Proof: scripts/test-generate.mjs (decode acceptance table + conflicts, gate
round-trip, generators, lint routing, adopt, manifest hand-edit detection, the
self-verify guardrail dry-run, a regex answers-YAML round-trip, never-block),
wired into CI. Genericity + hook-engine + setup + adapters-sync gates stay green.
Fixes surfaced by the proof: value-less doc rows no longer clobber concrete
interview values; conflict detection ignores same-stance and multi-instance
subjects; guardrail dry-run passes policy.git to the logic core (matching the
real hook); buildHooksPolicy deep-clones DEFAULT_POLICY (no shared mutation).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stage 7d of the harness-upgrade plan (agentic-dev-workflow). Completes
/setup-harnessfrom the interview record onward: decode every rule to its tier → the editable decomposition-table gate → generate a tailored, self-verified harness. Read-only until the gate; nothing enforcing is written before sign-off. Builds on 7a (#1) / 7b (#2) / 7c (#3), all merged.What lands
New machinery under
core/setup/(dependency-free, cross-platform Node):decode.mjsgate.mjsharness.decomposition.md), parse Tier/Action edits back, applyenforce/soften/drop, refuse to proceed while a conflict is unsettled.generate.mjshooks.policy.json(dual-target — CC hooks and opencode plugin read it),workflow.config.yaml,CLAUDE.md,.claude/rules/*, lint scaffolds (strongest layer), machine-specialized (investigate/ship) + new bespoke skills.adopt.mjsCLAUDE.md/hooks/rules to a timestamped folder, then decompose old prose into decode candidates — nothing lost.manifest.mjsharness.manifest.json— each artifact traced to its answers rows + hashed, so re-run/sync preserve hand-edits.verify.mjsThe runbook
setup-harness.mdgains phases 6–10 (adopt → decode → gate → generate → self-verify), replacing the read-only STOP handoff. READMEs + the skill description + regenerated adapters updated.Worked-example acceptance table (proven, zero Orbit leakage)
em-dash → hook·TB-#### branch → git-guardrails regex·never co-author → forbidden-trailer hook + omit fact·Confluence docs → decompose-each into its own tier·AWS CLI → tool-default rule·Jira MCP → rule + config. Every value comes from the interview/config — no SDLC constant is baked (a machine that BANS a trailer and one that REQUIRES it decode to opposite rows).Proof + gates
scripts/test-generate.mjs(wired into CI): the acceptance table, conflict flagging, the gate round-trip, the generators, lint routing, adopt, manifest hand-edit detection, the self-verify guardrail dry-run, a regex answers-YAML round-trip, and never-block. All five gates green locally: genericity · hook-engine · setup (7c) · generate (7d) · adapters-sync.Bugs surfaced + fixed by the proof: value-less doc rows no longer clobber concrete interview values; conflict detection ignores same-stance and multi-instance subjects; the guardrail dry-run passes
policy.gitto the logic core (matching the real hook);buildHooksPolicydeep-clonesDEFAULT_POLICY(no shared mutation).7d stops at a generated, self-verified harness. Pipeline wiring = 7e, bootstrap/lifecycle = 7f,
/update-harness= 7g, dogfood = 7i.🤖 Generated with Claude Code