rr-setup
暂无简介
- License 许可
- MIT
- 最近更新
- 2026-11-14
- Stars
- ★ 3
- Forks
- 0
02 资源文件 2
- 脚本scaffold_ai.py11.7 KB
- 脚本setup.py37.8 KB
03 SKILL.md 正文
/rr-setup $ARGUMENTS
Resolve the install root once; the skill is the same under Claude Code and Codex:
for AI_HOME in "${CLAUDE_CONFIG_DIR:-$HOME/.claude}" "${CODEX_HOME:-$HOME/.codex}"; do
[ -d "$AI_HOME/skills/rr-setup" ] && break
done
STATE="python3 $AI_HOME/skills/ai-task/state.py"
UPDATE="python3 $AI_HOME/skills/project-update/update.py $PWD"
SETUP="python3 $AI_HOME/skills/rr-setup/setup.py"
--options, --update and --audit go to their sections below; anything else
is Setup. In every mode: no application code changes — not a rename, not a
formatting fix. Problems you find are written down, never fixed. Never read
.env, secrets, dumps or production logs. Do not commit; suggest the git add.
Setup
-
Options. Project memory, the runtimes, the survey depth and
verify_commandare asked once, in one dialog, before any work; the picks feed steps 1, 3 and 5."$AI_HOME/skills/ai-init/scaffold-ai.sh" "$PWD" --runtime none # 0a $SETUP options --open # 0b; --options adds --all, a given --survey adds --skip survey0a makes
.ai/(so.ai/policies/dialog.json) and its.gitignorelines, with no instruction file and no runtime directory; only this script takesnone(project-scaffold.shrefuses it). If its output does not list.ai/project/overview.md, the project was set up before.0b prints one of three first lines:
OPTIONS_DIALOG D<n> …, then state.py'sDIALOG_PENDINGline and a JSON: send that JSON exactly as printed with the dialog tool the line names (AskUserQuestion; Codex: request_user_input).OPTIONS_FALLBACK <why>: nothing was opened. Ask the numbered questions after it in chat as printed, the answers being the picks; show itsmemory is the human'sline as printed and never run it.OPTIONS_NONE: nothing to ask.
Exit 6 (no first line, the reason on stderr):
DECISION_LIMITorDECISION_DUPLICATEmeans a decision is already open — settle every one first ($STATE decision showand send it, or$STATE decision fallback --id <Dn> --why "<why>"), then run 0b once more. Any other refusal, or a second one: ask the questions of steps 1, 3 and 5 in prose and, in a git work tree, give the human for their own terminal, with$AI_HOMEand$PWDsubstituted:python3 "<home>/skills/ai-task/state.py" --root "<project>" memory enable --period quarter [--index sqlite].0c — the human answers. After a dialog, a memory command they picked is run first, at once, verbatim and alone; it prints
memory: via dialog (consent C<n>, decision D<n>)and its pick settles its decision. Then$STATE decision settle --id <Dn>for each other decision: it printsD<n> settled: <label> (set)andSETUP_PICK <key>=<value>, after a declineSETUP_PICK <key>=. Apply each pick where its step needs it:runtime=<v>→ step 1's two scaffolds with--runtime <v>;verify=<cmd>→$SETUP verify --set "<cmd>"after step 2;keepandedit→ nothing;survey=lightorfull→ step 3's depth;keep→ no new survey;memory=offorkeep→ nothing: a picked command already ran.
An empty value (
verify=is "Not now"; any key after a decline) orother→ the step as it was without the dialog: step 1 passesauto, step 3 surveyslight, step 5 asks in chat. -
Scaffold. Both scripts are idempotent, never overwrite, and print what they created; note it, 0a's too. They take
--runtime auto|claude|codex|both(autofollowsCLAUDE.md/.claude/andAGENTS.md/.codex/); pass theruntimepick, elseauto—bothwhen the repository is worked on from both runtimes."$AI_HOME/hooks/project-scaffold.sh" "$PWD" --runtime <pick> # docs/sdlc/, the runtime dir, .gitignore "$AI_HOME/skills/ai-init/scaffold-ai.sh" "$PWD" --runtime <pick> # the instruction file; .ai/ is 0a'sIf 0a did not create
.ai/project/overview.md, the project was set up before: run --update below, then ask whether the survey should be refreshed; a refresh never overwrites a.ai/project/file a human edited without saying so first. If 0a and this step together created only an instruction file (no.ai/wanted), fill its Commands / Conventions / Architecture from the manifests — one line per command, five sentences of architecture — and stop. -
Stack.
$SETUP surveyfirst: the project's own toolbox (.claude/{skills,commands,rules,agents,hooks},.codex/*,bin/*.sh, Makefile targets) with each item's purpose, the guards a project hook already covers, a proposedverify_command, and the superpowers line. It runs nothing and writes nothing. Then a handful oflsandgrep -ncalls, not a delegation:composer.json,package.json,Makefile,pyproject.toml,go.mod, compose files, CI config,Chart.yaml/argocd/, test and lint configs (phpunit.xml*,phpstan.neon*,playwright.config.*…). For Symfony or Sylius also: bundles, entities, state machines, Messenger, event subscribers, payment, shipping, tax, promotions, ERP or fiscal integrations. Then write theverify=<cmd>pick, if any (0c). -
Survey. The depth is the
surveypick or--survey light|full.light, the default, is for a developer who knows the project: ask for a ten-minute brain dump (entry points, modules that matter, integrations, unwritten business rules, areas nobody dares touch), confirm each claim withgrep -n, then fan out exactly twoai-discoveryagents in one message: (1) legacy, risks and code that looks unused; (2) tests, CI/CD, data and configuration — how secrets are supplied, never their values.full, for a codebase new to you: oneExplorefor the inventory, then sixai-discoveryagents in one message — entry points; domain modules; integrations and their failure handling; business rules and legacy; tests and CI/CD; data and configuration. Hand each the slice of the inventory it needs. Each agent runs on its own tier; do not move it. -
Write
.ai/project/. Keep every label verbatim — KNOWN FACT withfile:line, INFERENCE with what it rests on, UNKNOWN with what would answer it, RISK with what could go wrong. Where documentation and code disagree, writeDocumented behaviour / Observed behaviour / Evidence / Riskand do not resolve it. -
Policies. Fill the project sections of
.ai/policies/coding.mdandtesting.mdonly if 0a created them. The Verification block oftesting.mdis the feedback loop every task runs:verify_command— the fast suite to the end, the e2e group excluded;step_test_command— the same runner on given paths ({files});e2e_command— the end-to-end suite, ornonewhen there is none;- two or three lines of what healthy output looks like.
verify_commandcomes from the human: theverify=<cmd>pick is their yes, written at the end of step 2; without one, show the one$SETUP surveyproposed, ask, and only after a yes in chat write it with$SETUP verify --set "<command>"(exit 3: one is already set — the human edits it).$SETUP checkthen exits 0;VERIFY_COMMAND_MISSING(exit 1) means setup is not finished, and the report says so.Copy them under
## Verificationin the project instruction file. Shared policies (database.md,tooling.md,release.md…) live in<home>/riskrails/ai/and are never written there; when the project has something to say in one, copy the whole file that"$AI_HOME/riskrails/ai-path" policies/<name>.mdprints to.ai/policies/<name>.mdand fill that copy — it is now an override. Check that.claude/settings.jsonkeeps"enableAllProjectMcpServers": falseand that each server in a checked-in.mcp.jsonsits inenabledMcpjsonServersonly if it earned it, else indisabledMcpjsonServers; say what you found. -
Weight table. The plugin ships the table; this codebase's own paths go in
.ai/policies/weight.project.json, laid over it:domain.modules(money, identity, personal data),domain.customer_visible,scope.hot_paths,reversibility.needs_stepandirreversible, and one or twoexamplesper mode. The JSON is the human's to edit (the path guard refuses yours);--updaterendersweight.mdfrom the table and the overlay. The thresholds are not this skill's to move. -
Constitution. Fill
docs/sdlc/constitution.md: C1–C5 ship prefilled; C6 onwards are one line each, drawn from what the code and tests already enforce. Leave a slot empty rather than write a platitude; at most fifteen.python3 "$AI_HOME/skills/project-update/render_instructions.py" constitution docs/sdlc/constitution.mdchecks the cap. Show the list for confirmation. -
Assessment. Write
.ai/project/initial-assessment.mdyourself (a human reads it): overview, architecture, important modules, critical business areas, legacy hotspots, high-risk integrations, test and CI maturity, security observations, missing documentation, areas agents must not touch casually, the weight-table entries you chose, recommended next improvements — recommendations only, none implemented. When the survey found a toolbox, name each toolbox item the project keeps using; they stay where they are. -
Report. Files created (a tree from the scaffold output, 0a's too), surprising findings, the modes and what puts a change in each, the safety restrictions in force (hooks versus policy), the tooling the workflows reuse, assumptions, unresolved questions and who can answer them, the survey's superpowers line as printed (the
enabledPluginsline is the human's to add — never write it), and the suggested first task:/rr-plan <it>. Claim nothing was validated that was not run. Suggestgit add .ai .gitignore docs/sdlcplus the instruction files created (.ai/memory/and.ai/reports/are git-ignored; memory stays local unless the human runsmemory enable --share git).
--options
Reopens every option on a set-up project: 0a, then $SETUP options --open --all, then
send, settle and apply as in step 0 — a survey pick runs steps 3–4 at that depth, as a
refresh (step 1), and a verify command is written at once. Say what changed and stop;
no other step reruns. A project 0a just scaffolded (it listed
.ai/project/overview.md) continues as the plain Setup.
--update
The script regenerates; you show it, confirm what is owed, and merge what it
cannot. It converts nothing but the one split. A tree that still holds an old
shape it detects (the pre-3.4b task state without state.json, the risk-tier
policy without a weight table, a pre-3.4b block marker) is refused with KEPT_UNREADABLE (exit 6); a
project last updated before 3.1.0 goes through npx riskrails@3.1.0 first. Run it right after a new
riskrails is installed: until then the project's old shapes are not read.
$STATE status: with a task in flight, say that updating policies mid-task can change what the rest of it needs, and ask whether to finish it first.$UPDATE— the dry run; show it as is. Up to date and no hint: say so, stop. Aregenerateis a file that matches a version the plugin once shipped and is replaced; aregenerate?ordelete?is a proposal for the human (step 4); acreateis a file the project lacks. A project that still has the mixedtesting.mdandweight.jsongetsverification.mdandweight.project.jsonsplit out of them once.- A
splitrow writesverification.mdorweight.project.json, which humans own from then on: say in one plain sentence what it carries out oftesting.mdorweight.json, and ask, unless$ARGUMENTSholds--apply. $UPDATE --apply. Exit 3 stopped on a changed, non-regular or unwritable file and names it; nothing after it was written — run the dry run again. Exit 6 (KEPT_UNREADABLE): a file the update keeps cannot be read; nothing was written — name it, the human fixes or removes it, then run again. Aregenerate?and adelete?are the human's. Never pass--confirm-deleteor--confirm-cleanup, not even with--apply. Give them, with$AI_HOMEand$PWDsubstituted, for their own terminal (the!prefix is refused):python3 "<home>/skills/project-update/update.py" "<project>" --apply --confirm-delete "<your name>". Exit 5 (CONFIRM_REFUSED) means an agent session ran it; it wrote nothing. Every file replaced or deleted that way is first copied under.ai/reports/project-update-<date>/original/. Two kinds are housekeeping:[rules]— every rule source.ai/rules/<slug>.md(an update does not keep them; confirming deletes the source and its rendered blocks with it) and a rendered rule file whose source is gone or no longer setspaths:, both settled by--confirm-delete;[cleanup]— the*.logfiles of closed tasks, and the report and log files of an abandoned task (itsstate.jsonstays) or of one unclosed for more than seven days (never the task in flight; and none when.ai/state/state.jsonis unreadable).--confirm-deletedoes not settle[cleanup]rows, and the rows differ by kind: files under.ai/state/logs/are git-ignored and git cannot restore them; files under.ai/reports/are usually tracked, and the row says "tracked: git can restore a committed copy" or, when git holds no committed copy, "uncommitted" — then commit.ai/first (the hint says so), and anoriginal/copy is kept as for any other deletion. They have their own command, the human's too, never passed by the agent:python3 "<home>/skills/project-update/update.py" "<project>" --apply --confirm-cleanup "<your name>". Show both groups as printed. Rollback is git:git restore --source=<commit before> --staged --worktree -- .ai, before the plugin itself is rolled back.- A
regenerate?row: the project edited a file the plugin generates. Read its reason; anything project-specific in it belongs in a file the update keeps (.ai/project/,weight.project.json,verification.md, the instruction file outside the managed block — not.ai/rules/, whose sources are[rules]rows too) — say where, the human moves it, then confirms. Never edit the generated file to dodge the row. - Hints.
verify_command is empty: show$SETUP survey's proposal, ask for the one command and what a green run ends with, write it with$SETUP verify --set, and fill the rest of the Verification block.the managed block is N B: edited here — offer to move the project's lines out of the markers; the plugin ships it that size — a plugin bug, report it. A constitution over fifteen principles or 4096 B: offer to move policy into.ai/policies/.that rule is not rendered: name the.ai/rules/file and what it lacks (paths:and a body).overrides the plugin's shared copy: offer to diff each and delete those that add nothing.tracked by git but ignored: show the line as printed and give the human the command it prints, exactly as printed, plus a commit, for their own terminal (never rebuilt from the path; only the xargs form untracks every such file under.ai/state, a printedrm --cached -- <path>one file; a second machine runs the same before its next pull, else a modify/delete conflict); never run it yourself. $UPDATE --checkandgit diff --stat; say what changed, what you merged and what is the human's. Suggestgit add -A .ai docs/sdlc .gitignore(the record and task logs are git-ignored) plus the runtime directories and instruction files.
--audit
The only file written is docs/ai-sdlc-adoption-plan.md; everything else is
read-only, and the plan builds on what exists rather than replacing it.
- Context. Read
.ai/project/overview.mdif it exists; otherwise ask once: what the project is, team size and who decides product and architecture, the CI/CD and staging, the tracker, hard constraints. Do not invent it. - Inventory, with
Exploreand, where judgement is needed,ai-discovery: instruction files at the root and nested (and whetherCLAUDE.mdandAGENTS.mdagree), runtime config (.claude/settings*.json,.codex/config.toml, hooks, skills, agents), CI workflows, branch protection (gh api …/protectionwhen authenticated, else unverified), test, build and lint entry points,REVIEW.md,docs/sdlc/,docs/adr/,.ai/. Each: exists / partial / missing, and one line on quality. - Score the twelve plays 0–3 from
$AI_HOME/skills/ai-audit/templates/play-scoring-rubric.md, citing file and line; unverified rather than a guess, with what would settle it. This is judgement: do it in the session, from step 2's evidence. - Three phases of about two weeks, in dependency order: instruction file, skills, feedback loop, hooks, planning first; subagents and evals after the instruction file and feedback loop; the PR review loop after evals; CI/CD after the review loop and hooks; closing the loop last. Each item: the play and target score, the files with a sketch, the owner role, prerequisites, governance, one leading and one lagging metric with its data source.
- Guardrails, separately, each with its minimal fix: permissions wider than
intended, hooks bypassable or agent-editable, secrets reachable (also through
Bash), tests editable during a fix, stale or contradictory instruction files,
a guardrail present in one runtime and absent in the other, and — without
.ai/— that only the global git guard applies. - Copy
$AI_HOME/skills/ai-audit/templates/ai-sdlc-adoption-plan.mdtodocs/ai-sdlc-adoption-plan.md, fill it (about four pages), and say plainly what you could not verify.
04 同仓库更多 Skills
sylius-fixtures
Load the Sylius fixture suite into the local database
deploy-staging
Deploy the current branch to staging and smoke-test the checkout. Use on "deploy to staging".
rr-status
暂无简介
rr-spec
Turn a rough idea into one file, docs/sdlc/specs/<slug>.md — an `## Intent` section (problem, outcome, affected users and systems, constraints, decisions taken) from a short one-question-at-a-time brainstorm recorded through state.py, then requirements and design from the architect agent on the STRONG tier, checked against the project's constitution, instruction files, skills and ADRs, ending with explicitly flagged concerns (especially contradicting policies). Accepts an existing docs/sdlc/intent/<slug>.md instead of the brainstorm. Use when starting a feature, "write the spec", "let's define what we want", "design this", before any plan or code.
rr-ship
Close the task — state.py close measures the two facts (a green whole-suite verify on the tree as it is now; every changed file inside the task's files), applies the mode table and either archives the task or, in full mode, requests the human's approval and prints the exact approve command for their own terminal. Writes the commit message body and suggests the commit; never merges or deploys, and commits, pushes or approves only as the command the human picked in the dialog, verbatim, once. Use on "/rr-ship", "close the task", "ship it", "ready for approval", after /rr-build or /rr-review.
rr-review
One adversarial review of the task's change, at the tier its mode sets — BALANCED in guarded, STRONG in full, security-focused when the domain axis is 2, and in light only when close reports a red fact. A fresh ai-reviewer reads the diff with bounded inputs, returns FINDINGS and a VERDICT, and state.py records them; in-scope BLOCKER and HIGH findings are fixed as one batch, closed by a green verify or one scoped re-review. The pass past the budget is the human's. Use on "/rr-review", "review this", after /rr-build in guarded or full mode, or when close says a review is required.