[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-82322":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":12,"stars30d":14,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":15,"rankGlobal":9,"rankLanguage":9,"license":9,"archived":16,"fork":16,"defaultBranch":17,"hasWiki":18,"hasPages":16,"topics":19,"createdAt":9,"pushedAt":9,"updatedAt":20,"readmeContent":21,"aiSummary":22,"trendingCount":12,"starSnapshotCount":12,"syncStatus":23,"lastSyncTime":24,"discoverSource":25},82322,"rgr","kingbootoshi\u002Frgr","kingbootoshi","Strict Red-Green-Refactor CLI gate for coding agents",null,"TypeScript",22,0,21,1,37.1,false,"main",true,[],"2026-06-12 04:01:37","# RGR\n\n![RGR header](assets\u002Frgr-header.png)\n\n`rgr` is a no-dependency Red-Green-Refactor gate for coding agents. It gives agents a human-operator style CLI that records the failing test first, freezes that test with hashes and snapshots, and refuses to mark Green or Refactor if the Red test was edited.\n\n## Install\n\nClone the repo and run it with Bun:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fkingbootoshi\u002Frgr.git\ncd rgr\nbun run rgr -- --help\n```\n\nOptional: link the CLI onto your PATH:\n\n```bash\nbun link\nrgr --help\n```\n\nFrom this repo:\n\n```bash\nbun run rgr -- --help\n```\n\nFrom another repo:\n\n```bash\nbun run \u002Fpath\u002Fto\u002Frgr\u002Fsrc\u002Fcli\u002Findex.ts --root . --help\n```\n\nThe workflow examples below assume `rgr` is on your PATH. If it is not, replace `rgr` with `bun run \u002Fpath\u002Fto\u002Frgr\u002Fsrc\u002Fcli\u002Findex.ts`.\n\n## Agent Plugins\n\nRGR ships **two** skills as both Claude Code and Codex plugins, the two halves of trustless engineering:\n\n- **`rgr`** — proves behavior and scope at one CI verdict (this tool).\n- **`intent-contract`** — turns a request into a signed Locked Intent Boundary before any planning, so an agent cannot redefine the goal. It compiles to an IntentLock that `rgr verify --intent-lock` enforces. See [`skills\u002Fintent-contract\u002FSKILL.md`](skills\u002Fintent-contract\u002FSKILL.md).\n\nTogether: intent-contract writes the law, rgr is the court that proves the work stayed inside it. See [Trustless Enforcement](#trustless-enforcement-intent-contract--rgr).\n\nClaude Code:\n\n```bash\nclaude plugin marketplace add kingbootoshi\u002Frgr\nclaude plugin install rgr@rgr\n```\n\nFor local Claude Code testing from a clone:\n\n```bash\nclaude --plugin-dir .\n```\n\nCodex:\n\n- Plugin manifest: `.codex-plugin\u002Fplugin.json`\n- Shared skill: `skills\u002Frgr\u002FSKILL.md`\n- Codex UI metadata: `skills\u002Frgr\u002Fagents\u002Fopenai.yaml`\n\nInstall the repo root as the plugin directory in Codex, then invoke `$rgr` when a code change should use strict Red-Green-Refactor proof. The bundled `intent-contract` skill is discovered the same way (`skills\u002Fintent-contract\u002F`).\n\n## Trustless Enforcement (intent-contract + rgr)\n\nThe endgame: accept an agent's work without trusting the agent, because a gate it cannot bribe has already proven the work stayed inside the human's intent and functions.\n\n1. **Lock intent.** `intent-contract` produces a small, human-signed Locked Intent Boundary: required deltas, invariants, non-substitutions, and authorized-change rights (every diff op must map to a row). It compiles to a hash-pinned **IntentLock**.\n2. **Freeze it.** `rgr lock-intent --intent-lock \u003Cpath> --expect-sha256 \u003CH>` verifies the lock's payload hash and stores a copy under `.rgr\u002F` as evidence.\n3. **Enforce one verdict.** `rgr verify --ci --replay --intent-lock \u003Ctrusted> --expect-intent-sha256 \u003CH>` proves behavior (Red-Green-Replay) **and** scope (every `git diff --no-renames --name-status \u003ClockedBase>...HEAD` op maps to an authorized row) in a single pass.\n\nThe load-bearing property: **`.rgr\u002F` is evidence, not authority.** CI reads the trusted lock from a path the agent does not control, hash\u002Fsignature-verifies it, and audits the real diff against that. Tampering the in-tree copy changes nothing. A non-ancestor base or a dirty working tree fails closed. Deny rows (`ops: []`) fail on contact.\n\nA signed boundary lives at `docs\u002Fprds\u002Fintent-lock-scope-audit.intent-boundary.md` — this feature was built under its own boundary and self-audited.\n\n## Core Workflow\n\n```bash\n# 1. Initialize a manifest for this goal.\nrgr init --goal-id billing-scope\n\n# 2. Write only the failing test, then capture Red.\nrgr red --strict --goal-id billing-scope --test src\u002Fbilling.test.ts -- bun test src\u002Fbilling.test.ts\n\n# Optional: explicitly freeze a helper, fixture, snapshot, or config file that defines the Red oracle.\nrgr red --strict --goal-id billing-scope --test src\u002Fbilling.test.ts --protect tests\u002Ffixtures\u002Fbilling.ts -- bun test src\u002Fbilling.test.ts\n\n# 3. Implement production code, then prove Green.\nrgr green\n\n# 4. Refactor only while the Red test is still byte-for-byte unchanged.\nrgr refactor -- bun test\n\n# 5. Final gate for local CI or sandbox authority.\nrgr verify --ci --replay -- bun test\n```\n\nEvery run writes `.rgr\u002Fmanifest.json`, `.rgr\u002Fevents.jsonl`, snapshots, diffs, and command output logs.\n\nWhen an older completed cycle has known replay-only environment noise, targeted replay can keep later cycles moving while still requiring Green receipts, protected heads, and the final verify command. Treat this as an exception path and report the replay scope.\n\n```bash\n# Replay only the latest active cycle.\nrgr verify --ci --replay --cycle latest -- bun test\n\n# Replay active cycles from a known cycle onward.\nrgr verify --ci --replay --from-cycle 004 -- bun test\n```\n\n## What It Enforces\n\n- Red must fail.\n- Red defaults to test-surface changes only.\n- Red records protected test files with SHA-256 hashes and snapshots.\n- Green refuses to run if any protected Red file changed.\n- Refactor and Verify refuse to pass if protected Red files changed.\n- Every command proof uses argv after `--`, currently direct `bun test` only.\n- Green runs the exact Red command.\n- Strict Red protects imported test helpers, fixtures, snapshots, package\u002Ftest config, and lockfiles that can change what the test means.\n- `--test` is only for root assertion-bearing tests; use `--protect` for helpers, fixtures, snapshots, and test config.\n- `inspect-test` inspects root tests and reports protected support separately, so fixtures are not warned for lacking `expect()`.\n- `verify --ci --replay` reconstructs the Red proof from the recorded git base commit and protected snapshots.\n- `verify --ci --replay --cycle latest` replays only the latest active cycle; `--from-cycle \u003Cid>` replays active cycles from that id onward and reports skipped active cycles.\n- Same-file multi-cycle work is supported through current protected heads: each Red hash is frozen through its Green, then a later Red can intentionally advance the file.\n- Wrong tests must be superseded through `rgr revise-test`, then replaced by a new Red proof.\n- `verify --ci` requires every active cycle to have Red and Green receipts.\n- `--allow-source-changes` permits reviewed source dirtiness that already existed before Red starts and snapshots that dirty source into replay; the Red command itself may not create commits or modify source files.\n\n## Threat Model\n\nThis tool gives honest agents and CI a deterministic contract. If an agent has unrestricted write access to the same repo, it can still delete `.rgr` or bypass the CLI. Treat local use as a discipline gate and make `rgr verify --ci --replay -- bun test` mandatory inside CI, sandboxes, or agent harnesses when the result must be authoritative.\n\nFor authority, use strict replay:\n\n```bash\nrgr verify --ci --replay -- bun test\n```\n\n## Test Discipline Prompt\n\nUse:\n\n```bash\nrgr prompt\n```\n\nIt prints a compact instruction block for agents that need to write meaningful tests instead of shallow mock-echo tests.\n","rgr 是一个为编码代理设计的红绿重构（Red-Green-Refactor）CLI 门控工具。它提供了一个类似人类操作员的命令行界面，能够记录首次失败的测试，并通过哈希和快照冻结该测试，在未编辑红色测试的情况下拒绝标记为绿色或重构状态。项目采用 TypeScript 编写，无外部依赖，确保了轻量级与高效性。适用于需要严格控制代码变更范围并验证其正确性的开发场景，尤其是当开发者希望在不完全信任自动化代理时也能保证代码质量的情况下。结合提供的意图合约插件，rgr 可以实现从定义需求到验证实现全过程的信任最小化工程实践。",2,"2026-06-11 04:08:23","CREATED_QUERY"]