rulecast
rulecast
Your project's conventions, checked while your coding agent works.
rulecast runs as your coding agent's hooks. When an edit breaks one of your project's rules, the agent is told in the same turn, along with the part of your docs the rule comes from, so it can fix the code before it moves on.
A rule is a check, such as a regex, an ast-grep pattern, a linter or a command, together with a message and a section of your docs. The same rules run in git hooks and CI.
It also works when nobody is watching, in a /goal run, under claude -p or in CI. There rulecast holds the agent at each stop, up to a limit, until its findings are fixed or written into its final report. rulecast run also gives the loop an exit code to stop on. You still decide which conventions become rules. Agent loops guide
1 Your docs say it
conventions/backend.md
Errors
Services raise domain exceptions. app/api/errors.py maps each one to a status code.
2 A rule checks for it, and cites it
.rulecast-config.yaml
- id: backend/no-httpexception files: '^app/services/.*\.py$' detect: regex: pattern: 'raise\s+HTTPException\((?<args>[^)]*)\)' message: "{{file}}:{{line}} raises HTTPException({{args}}) in the service layer. Raise a domain exception; the API layer maps it to a response." context: - "@conventions/backend.md#errors"
3 An edit breaks it, and your agent hears both, in the same turn
Around the tools it already uses.
rulecast runs as your agent's hooks. Nothing to start, no daemon.
- Session starts
start - rulecast records the working tree, so it can tell later what changed.
- Reads a file
touch - The conventions for that file arrive once, with their doc sections.
- Edits a file
guard · edit - A protected file is refused before the write. Anything else is checked after it, and new findings come back in the same turn.
- Runs a command
shell-before · shell-after - What the command wrote is checked like an edit. A protected file it touched must be reverted.
- Tries to stop
verify - It is held back while a new error stands: once per prompt by default, or up to ten times in an unattended run, after which what's left goes into the agent's final report. Changes no tool call explains are reported and never block.
Let your agent set it up.
Paste this into your coding agent. It installs rulecast, then shows you every file it changed.
Set up rulecast in this project. Read https://syv-ai.github.io/rulecast/agents/SETUP.md and follow it. Show me every file it creates or changes before I commit anything.