Skip to content

[Feature] /codify-rule — turn human review comments into draft handbook entries #296

@atlas-apex

Description

@atlas-apex

User Story

As an operator using ApexYard's Rex agent, I want a /codify-rule skill that turns a human-review comment (that caught a Rex-miss) into a draft handbook entry, so that the handbook layer compounds on Rex's actual misses rather than only the rules an operator thought to write proactively.

Acceptance Criteria

  • /codify-rule invokable from any PR context (current PR inferred from branch / cwd, or passed as arg)
  • Skill prompts for the human's review comment text (the thing Rex should have caught)
  • Skill extracts the file:line context from the comment if present, otherwise asks
  • Skill drafts a handbook entry following the standard shape: # Handbook: <title> / ## The rule / ## Why / ## What Rex flags / ## Sample finding / ## What's NOT a violation
  • Operator-approves the draft (Y/edit/N) before any file is written
  • Captured rule includes a "Source: PR #N comment by @author on YYYY-MM-DD" footer for traceability
  • Written to the right bucket: domain handbook if the comment named a domain (paths: frontmatter pre-populated); architecture handbook if pattern matches existing arch concerns; general otherwise
  • Default to advisory enforcement; operator can opt the draft into ENFORCEMENT: blocking
  • Re-run on a PR that already had a /codify-rule capture appends as a new entry, doesn't overwrite

Design Notes

This is Stage 2 of #293 (Rex domain-aware handbooks). Stage 1 (the path-glob discovery foundation) merged via PR #294 / commit 28b3b76. Stage 3 (/enrich-domain for mining recent PRs) is a separate follow-up ticket.

Bumping above other v1.5 items because the harness can only improve itself if this exists. Without /codify-rule, the handbook layer stays at "rules an operator thought to write" — a static slice. With it, the layer becomes a learning surface that compounds with every Rex-miss.

Reference: industry harness-engineering "steering loop" — "whenever an issue happens multiple times, the feedforward and feedback controls should be improved". /codify-rule is the operator-side hook into that loop.

Out of Scope

  • Mining historical PRs (that's Stage 3 / /enrich-domain)
  • Auto-suggesting rules without operator approval — every capture is Y/N gated
  • Cross-project rule propagation (single project's handbooks/domain/<area>/ only)

Glossary

Term Definition
Rex-miss A bug a human caught in review that Rex didn't flag — exactly the kind of miss a domain handbook could prevent next time
Steering loop industry harness-engineering's term for the operator's job — iterating the harness based on observed miss patterns
Capture The shape of evidence /codify-rule extracts: comment text + file:line + author + PR#

Surfaced 2026-05-19 reading industry harness-engineering article; matches the planned Stage 2 of #293.

Metadata

Metadata

Assignees

No one assigned

    Labels

    P1High — material gap or user-impactingenhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions