How itsthecsguy/ratchet works
Ratchet turns repository guidance into deterministic checks, then evaluates those checks during linting, setup, tool-call hooks, and finish-time checks. The main CLI dispatches ordinary commands, while hook events take a fast path into the hook runtime. Supporting layers parse skills, assemble plans, inspect repository state, and render findings; model testing evaluates prose-oriented rules with agent CLIs. The README documents the product workflow and harness coverage. Some IO and hook internals were not excerpted, so undocumented runtime links are omitted.
Main entry points: commands.rs Commands · lib.rs Hook runtime · plan.rs Plan loader · main.rs CLI entry
Components 31
CLI workflows
- CLI entry
crates/ratchet-cli/src/main.rs - Commands
crates/ratchet-cli/src/commands.rs - Guidance detection
crates/ratchet-cli/src/detect.rs - Rule catalogue
crates/ratchet-cli/src/catalogue.rs - Skill lint
crates/ratchet-cli/src/lint.rs - Updater
crates/ratchet-cli/src/update.rs
Rules and evaluation
- Skill parser
crates/ratchet-syntax/src/skill.rs - Rule checks
crates/ratchet-syntax/src/checks.rs - Guidance checks
crates/ratchet-syntax/src/guidance.rs - Plan loader
crates/ratchet-io/src/plan.rs - Action evaluator
crates/ratchet-core/src/action.rs - Freshness checks
crates/ratchet-core/src/freshness.rs - Stop checks
crates/ratchet-core/src/stop.rs - Finding renderer
crates/ratchet-core/src/render.rs
Agent integrations
- Hook runtime
crates/ratchet-hook/src/lib.rs - Harness adapters
crates/ratchet-hook/src
Repository state
- Git inspection
crates/ratchet-io/src/git.rs - Path discovery
crates/ratchet-io/src/paths.rs - Local state
crates/ratchet-io/src/state.rs - Skill files
crates/ratchet-io/src/skills.rs - Session transcripts
crates/ratchet-io/src/transcript.rs - Harness setup IO
crates/ratchet-io/src/harness.rs - Git hook setup
crates/ratchet-io/src/githook.rs
Model evaluation
- Model specifications
crates/ratchet-modeltest/src/spec.rs - Agent driver
crates/ratchet-modeltest/src/driver.rs - Test sandbox
crates/ratchet-modeltest/src/sandbox.rs - Verdict evaluator
crates/ratchet-modeltest/src/verdict.rs - Test reports
crates/ratchet-modeltest/src/report.rs
Other components
- Engineer
- Coding agent
- Agent harness
Connections 34
- Engineer → CLI entry: runs commands
README.md - CLI entry → Commands: dispatches
crates/ratchet-cli/src/main.rs - CLI entry → Hook runtime: routes hook events
crates/ratchet-cli/src/main.rs - Commands → Guidance detection: discovers guidance
crates/ratchet-cli/src/commands.rs - Commands → Rule catalogue: proposes rules
crates/ratchet-cli/src/commands.rs - Commands → Skill lint: runs lint
crates/ratchet-cli/src/commands.rs - Commands → Updater: runs update
crates/ratchet-cli/src/commands.rs - Skill lint → Skill parser: parses skills
crates/ratchet-cli/src/lint.rs - Skill parser → Rule checks: uses checks
crates/ratchet-syntax/src/skill.rs - Skill parser → Guidance checks: uses guidance
crates/ratchet-syntax/src/skill.rs - Commands → Plan loader: loads rules
crates/ratchet-cli/src/commands.rs - Plan loader → Skill files: reads skills
crates/ratchet-io/src/plan.rs - Plan loader → Git inspection: uses git data
crates/ratchet-io/src/plan.rs - Plan loader → Path discovery: resolves paths
crates/ratchet-io/src/plan.rs - Plan loader → Local state: refreshes cache
crates/ratchet-io/src/plan.rs - Hook runtime → Harness adapters: dispatches adapters
crates/ratchet-hook/src/lib.rs - Agent harness → Hook runtime: sends tool events
README.md - Hook runtime → Plan loader: evaluates loaded rules
- Hook runtime → Action evaluator: checks actions
- Hook runtime → Freshness checks: checks freshness
- Hook runtime → Stop checks: checks completion
- Action evaluator → Finding renderer: renders findings
crates/ratchet-core/src/action.rs - Freshness checks → Finding renderer: renders findings
crates/ratchet-core/src/freshness.rs - Freshness checks → Git inspection: checks changes
- Stop checks → Finding renderer: renders findings
- Commands → Harness setup IO: configures hooks
- Commands → Git hook setup: installs git hook
- Commands → Session transcripts: audits sessions
- Commands → Model specifications: configures model tests
- Model specifications → Agent driver: selects driver
crates/ratchet-modeltest/src/driver.rs - Agent driver → Test sandbox: runs in sandbox
crates/ratchet-modeltest/src/sandbox.rs - Test sandbox → Verdict evaluator: evaluates run
crates/ratchet-modeltest/src/verdict.rs - Verdict evaluator → Test reports: reports verdict
- Agent driver → Coding agent: launches CLI
crates/ratchet-modeltest/src/driver.rs